Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-05 Thread Wayne Watson
I should have mentioned I use windows. import numpy numpy.__version__ It's now written in my Py book! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-05 Thread David Hutto
On Thu, Aug 5, 2010 at 8:53 PM, David Hutto wrote: > On Thu, Aug 5, 2010 at 7:33 PM, Wayne Watson > wrote: >> It's been awhile since I've used python, and I recall there is a way to find >> the version number from the IDLE command line  prompt. dir, help, >> __version.__? >> >> I made the most mi

Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-05 Thread David Hutto
On Thu, Aug 5, 2010 at 7:33 PM, Wayne Watson wrote: > It's been awhile since I've used python, and I recall there is a way to find > the version number from the IDLE command line  prompt. dir, help, > __version.__? > > I made the most minimal change to a program, and it works for me, but not my >

Re: [Tutor] how to do excel in python

2010-08-05 Thread Thomas C. Hicks
On Thu, 5 Aug 2010 10:08:59 -0400 invincible patriot wrote: > hi, > can any one tell me how can I access MS excel worksheet in python and > how can I access itz individual cells..?? > I have had good luck with the xlrd and xlwt modules, you can get them at www.python-excel.org. The Google

[Tutor] Finding the version # of a module, and py module problem

2010-08-05 Thread Wayne Watson
It's been awhile since I've used python, and I recall there is a way to find the version number from the IDLE command line  prompt. dir, help,  __version.__?  I made the most minimal change to a program, and it works for me, but not my partner. He gets Traceback (most recent call last):   F

Re: [Tutor] how to do excel in python

2010-08-05 Thread Alan Gauld
"invincible patriot" wrote hi, can any one tell me how can I access MS excel worksheet in python and how can I access itz individual cells..?? There are several Excel specific modules - try Google - or, using the standard library, and if its practical for your case, you can use CSV files

Re: [Tutor] how to do excel in python

2010-08-05 Thread Chris Fuller
There are many ways. The simplest is to export the file to CSV and load that, but you'll only get one worksheet, and it's a big hassle to update the Excel file that way. You can save the spreadsheet as an ODF file, which is a fully documented XML format that Python can read and write easily,

Re: [Tutor] how to do excel in python

2010-08-05 Thread Robert
> hi, > can any one tell me how can I access MS excel worksheet in python and how > can I access itz individual cells..?? let me google that for you... ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mai

Re: [Tutor] string to list

2010-08-05 Thread Huy Ton That
Speaking of which, is there some place you or anyone can recommend on picking up all the constructs for list comprehension & generator comprehension. I've perused the python.org documents and have just been building them according to example. How can I pick up more advanced usage? I mostly catch

Re: [Tutor] how to do excel in python

2010-08-05 Thread Tim Golden
On 05/08/2010 15:08, invincible patriot wrote: hi, can any one tell me how can I access MS excel worksheet in python and how can I access itz individual cells..?? http://www.python-excel.org/ (First hit for python excel in Google) TJG ___ Tuto

Re: [Tutor] getattr()

2010-08-05 Thread bob gailer
On 8/4/2010 4:32 PM, Huy Ton That wrote: I have a side question, I am using python 2.7. Why do you use class A: instead of class A(object): ? My example does not depend on old / new style classes. -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tuto

[Tutor] how to do excel in python

2010-08-05 Thread invincible patriot
hi, can any one tell me how can I access MS excel worksheet in python and how can I access itz individual cells..?? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http

[Tutor] Rép. : string to list

2010-08-05 Thread Luhmann
Try this: >>> def f(mystring):     charlist = list(mystring)     tmplist = [ [''] ]     for a in charlist:         if tmplist[-1][-1] == '/' or a == '/':             tmplist[-1].append(a)         else:             tmplist.append( [a] )     return  [''.join(a) for a in tmplist][1:] >>>  #Thusly:

Re: [Tutor] string to list

2010-08-05 Thread Walter Prins
Just a minor related/tangential suggestion -- O'Reilly had a stand at the recent EuroPython conference I attended and I was paging through "Bioinformatics Programming using Python", Book reference: http://oreilly.com/catalog/9780596154516 Just thought I'd mention it as it seems relevant to the cur

Re: [Tutor] string to list

2010-08-05 Thread Alan Gauld
"Vikram K" wrote Suppose i have this string: z = 'AT/CG' How do i get this list: zlist = ['A','T/C','G'] There are lots of ways and it really needs a tighter specification of yhow you split. What would "AT/C/DGH" give for example? But in general there are several approaches, I suspect r

Re: [Tutor] access class through indexing?

2010-08-05 Thread Alan Gauld
"Alex Hall" wrote Since you never call super(), the init of the base class never happens. ... actual object you're supposed to be initializing, and you immediately overwrite it (self) with another object. As a result, everything else you do in that method is thrown out when the method ret

Re: [Tutor] how to get str() to use my function?

2010-08-05 Thread Alan Gauld
"Alex Hall" wrote It worked, thanks. Is there a list of these functions somewhere? Learn to use the dir() and help() functions in Python at the >>> prompt. dir(obj) will show all the standard methods for that object. For the math operators try dir(5) - or any other number, 5.0 for a fl

Re: [Tutor] string to list

2010-08-05 Thread Thomas C. Hicks
On Thu, 5 Aug 2010 03:40:55 -0400 Sander Sweers wrote: > On 5 August 2010 06:38, Vikram K wrote: > > Suppose i have this string: > > z = 'AT/CG' > > > > How do i get this list: > > > > zlist = ['A','T/C','G'] > > If you know the format of the string is always the same you can do > something lik

Re: [Tutor] string to list

2010-08-05 Thread Sander Sweers
On 5 August 2010 06:38, Vikram K wrote: > Suppose i have this string: > z = 'AT/CG' > > How do i get this list: > > zlist = ['A','T/C','G'] If you know the format of the string is always the same you can do something like this. This fails when you have strings that do not have the '/' in the midd

Re: [Tutor] string to list

2010-08-05 Thread James Mills
On Thu, Aug 5, 2010 at 2:38 PM, Vikram K wrote: > Suppose i have this string: > z = 'AT/CG' > > How do i get this list: > > zlist = ['A','T/C','G'] >>> import re >>> z = 'AT/CG' >>> [x for x in re.split("([A-Z]\/[A-Z])|([A-Z])", z) if x] ['A', 'T/C', 'G'] >>> cheers James -- -- James Mills --