Re: [Tutor] float question

2005-12-20 Thread Danny Yoo
On Mon, 19 Dec 2005, linda.s wrote: > what does 2 mean in %2.4f ? Hello, It's a "minimal field width" modifier, according to: http://docs.python.org/lib/typesseq-strings.html Let's try experimenting with it. ## >>> '%20f' % 3.14 '3.14' >>> '%20.2f' % 3.14 '

Re: [Tutor] float question

2005-12-20 Thread linda.s
On 12/20/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Mon, 19 Dec 2005, linda.s wrote: > > > what does 2 mean in %2.4f ? > > Hello, > > It's a "minimal field width" modifier, according to: > >http://docs.python.org/lib/typesseq-strings.html > > > Let's try experimenting with it. > > ##

Re: [Tutor] float question

2005-12-20 Thread Pujo Aji
Th format %x1.x2fwhere x1 is the total space and x2  is decimal digit place.If your data is longer than the specified x1 and x2.the data rules.Look at 3.14 takes 4 places total# 4 places rules >>> '%3.2f' % 3.14'3.14'# perfect>>> '%4.2f' % 3.14'3.14'# try this >>> '%5.2f' % 3.14' 3.14'Cheers,pujo O

Re: [Tutor] float question

2005-12-20 Thread Alan Gauld
> what does 2 mean in %2.4f ? In this case nothing because it will always be over-ridden by the 4. Basically the first number specifies the *minimum* number of characters output, ie 2 in this case. The second number specifies the number of decimal placess output, 4 in this case. Since 4 decimal

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
Dear Drs. Johnson and Yoo , for the last 1 week I have been working on parsing the elements from a bunch of XML files following your suggestions. until now I have been unsuccessul. I have no clue why i am failing. I have ~16K XML files. this data obtained from johns hopkins university (of co

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread Kent Johnson
ps python wrote: > Dear Drs. Johnson and Yoo , > for the last 1 week I have been working on parsing > the elements from a bunch of XML files following your > suggestions. > > from elementtree.ElementTree import ElementTree > mydata = ElementTree(file='4.xml') for process in > > my

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
Thank you for your email Dr. Johnson. I need to print : gene_symbol (from line ALDH3A1) entry_cdna (from line NM_000691.3) molecular_class (from line Enzyme:Dehydrogenase) title (from tags Catalytic activity) title (from tags section Metabolism) title (from tags section cytoplasm) Thi

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread Danny Yoo
> >>> for m in mydata.findall('//functions'): > print m.get('molecular_class').text > > >>> for m in mydata.findall('//functions'): > print m.find('molecular_class').text.strip() > > >>> for process in > mydata.findall('//biological_process'): > print process.get('title').text

[Tutor] Learning books

2005-12-20 Thread Richard
Afternoon all, My son asked me what books I would like for Christmas this year. So what would you recommend? I am a beginner here. Thanks Richard ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] question !

2005-12-20 Thread Danny Yoo
On Mon, 19 Dec 2005, Krava Magare wrote: > How can I remove and add record ( dictionary type) to a file. Hi Krava, H... I have to admit that I don't understand the question yet. *grin* It looks like you're already pickling lists into your file. Picking dictionaries should be similar; a

Re: [Tutor] Learning books

2005-12-20 Thread nephish
Learning Python by O'Reilly, got me started after realizing that Programming Python by O'Reilly was a tad over me head. i am new here too. On Tue, 2005-12-20 at 14:46 -0600, Richard wrote: > Afternoon all, My son asked me what books I would like for Christmas > this year. So what would you recom

Re: [Tutor] Learning books

2005-12-20 Thread Danny Yoo
On Tue, 20 Dec 2005, Richard wrote: > Afternoon all, My son asked me what books I would like for Christmas > this year. So what would you recommend? Merry Chrismas! I'm partial to George Polya's "How to Solve It": http://www.math.utah.edu/~alfeld/math/polya.html It's not Python nor progr

Re: [Tutor] Learning books

2005-12-20 Thread Srinivas Iyyer
1. Learn to Program Using Python by Alan Gauld (Stage 1) 2. Learning Python by Mark Lutz and David Ascher (Stage 2) 3. If u are serious in learning python - my sincere advise : STICK TO THIS LIST. You can never find good teachers with lots of patience and with real appetite to teach elesewhere. T

Re: [Tutor] question !

2005-12-20 Thread Brian van den Broek
Krava Magare said unto the world upon 2005-12-19 17:31: > How can I remove and add record ( dictionary type) to a file. This is the > program that I'm working on: the program should create a text file, print > the contents of the text file, read the file after it's been created, add a > reco

[Tutor] How do I fix this IndexError?

2005-12-20 Thread Nathan Pinno
Here is the error: The Currency Exchange ProgramBy Nathan Pinno   Traceback (most recent call last):  File "D:\Python24\exchange.py", line 28, in -toplevel-    exch = pickle.load(store)  File "D:\Python24\lib\pickle.py", line 1390, in load    return Unpickler(file).load()  File "D:\Python2

Re: [Tutor] Learning books

2005-12-20 Thread Alan Gauld
> Afternoon all, My son asked me what books I would like for Christmas this > year. So what would you recommend? I love these questions! :-) > I am a beginner here. The question you need to answer is what do you want to get out of the book? For example you could get a book that teaches you the

Re: [Tutor] How do I fix this IndexError?

2005-12-20 Thread Simon Gerber
Hi Nathan, > Traceback (most recent call last): > File "D:\Python24\exchange.py", line 28, in -toplevel- > exch = pickle.load(store) > File "D:\Python24\lib\pickle.py", line 1390, in load > return Unpickler(file).load() > File "D:\Python24\lib\pickle.py", line 872, in load > disp

Re: [Tutor] How do I fix this IndexError?

2005-12-20 Thread Alan Gauld
Nathan, I haven't read your code in detail but from the error message: > Traceback (most recent call last): > File "D:\Python24\exchange.py", line 28, in -toplevel- >exch = pickle.load(store) > File "D:\Python24\lib\pickle.py", line 1390, in load >return Unpickler(file).load() > File "

Re: [Tutor] How do I fix this IndexError?

2005-12-20 Thread Nathan Pinno
Simon and all, What would you recommend? I don't know what I should code, because I haven't coded anything that loads a file. Thanks, Nathan Pinno MSN Messenger: [EMAIL PROTECTED] Yahoo! Messenger: spam_swatter31 AIM: f3mighty ICQ: 199020705 -Original Message- From: Simon Gerber [mail

Re: [Tutor] How do I fix this IndexError?

2005-12-20 Thread Simon Gerber
Hi Nathan, I've attached a crude hack that fixes the problem. It should give you an idea of how to proceed. I've put comments next to the things I've changed. Bear in mind I'm hardly more than a beginner myself, so there are definitely better ways to do this. But it's somewhere to start, anyway.

Re: [Tutor] How do I fix this IndexError?

2005-12-20 Thread Nathan Pinno
Thanks Simon! It worked like a charm! All I have to do now is change it into GUI format, and then use py2exe to create an executable file. Thanks for all the help! Nathan Pinno MSN Messenger: [EMAIL PROTECTED] Yahoo! Messenger: spam_swatter31 AIM: f3mighty ICQ: 199020705 -Original Message

Re: [Tutor] Learning books

2005-12-20 Thread Kent Johnson
Richard wrote: > Afternoon all, My son asked me what books I would like for Christmas > this year. So what would you recommend? I have started a book list on my web site. http://personalpages.tds.net/~kent37/BookList.html Kent ___ Tutor maillist - T

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
Dear drs. Yoo and johnson, Thank you very much for your help. I successully parsed my GO annotation from all 16,000 files. thanks again for your kind help --- Danny Yoo <[EMAIL PROTECTED]> wrote: > > > >>> for m in mydata.findall('//functions'): > > print m.get('molecular_class').text >