Re: read files

2008-01-21 Thread J. Peng
Gabriel Genellina 写道: > En Tue, 22 Jan 2008 02:03:10 -0200, Paul Rubin > <"http://phr.cx"@NOSPAM.invalid> escribió: > >> "J. Peng" <[EMAIL PROTECTED]> writes: >>> print line, >> Do you really want all the lines crunched together like that? If not, >> leave off the comma. > > Remember t

Re: read files

2008-01-21 Thread Gabriel Genellina
En Tue, 22 Jan 2008 02:03:10 -0200, Paul Rubin <"http://phr.cx"@NOSPAM.invalid> escribió: > "J. Peng" <[EMAIL PROTECTED]> writes: >> print line, > > Do you really want all the lines crunched together like that? If not, > leave off the comma. Remember that Python *keeps* the end-of-line

Re: read files

2008-01-21 Thread J. Peng
Thank you. That gave so much solutions. And thanks all. Steven D'Aprano 写道: > On Tue, 22 Jan 2008 11:00:53 +0800, J. Peng wrote: > >> first I know this is the correct method to read and print a file: >> >> fd = open("/etc/sysctl.conf") >> done=0 >> while not done: >> line = fd.readline() >>

Re: read files

2008-01-21 Thread Paul Rubin
"J. Peng" <[EMAIL PROTECTED]> writes: > print line, Do you really want all the lines crunched together like that? If not, leave off the comma. > I dont like that flag of "done",then I tried to re-write it as: > > fd = open("/etc/sysctl.conf") > while line = fd.readline(): > print li

Re: read files

2008-01-21 Thread Steven D'Aprano
On Tue, 22 Jan 2008 11:00:53 +0800, J. Peng wrote: > first I know this is the correct method to read and print a file: > > fd = open("/etc/sysctl.conf") > done=0 > while not done: > line = fd.readline() > if line == '': > done = 1 > else: > print line, > > fd.close()

Re: read files

2008-01-21 Thread Benjamin
On Jan 21, 9:08 pm, Mel <[EMAIL PROTECTED]> wrote: > J. Peng wrote: > > first I know this is the correct method to read and print a file: > > > fd = open("/etc/sysctl.conf") > > done=0 > > while not done: > > line = fd.readline() > > if line == '': > > done = 1 > > else: > >

Re: read files

2008-01-21 Thread Mel
J. Peng wrote: > first I know this is the correct method to read and print a file: > > fd = open("/etc/sysctl.conf") > done=0 > while not done: > line = fd.readline() > if line == '': > done = 1 > else: > print line, > > fd.close() > > > I dont like that flag of "don

Re: read files

2008-01-21 Thread Alex Ezell
You might could do one of these two methods: fd.readlines() or: for line in fd: print line These are both from the Python tutorial found here: http://docs.python.org/tut/node9.html#SECTION00921 /alex On Jan 21, 2008 9:00 PM, J. Peng <[EMAIL PROTECTED]> wrote: > first I kno

read files

2008-01-21 Thread J. Peng
first I know this is the correct method to read and print a file: fd = open("/etc/sysctl.conf") done=0 while not done: line = fd.readline() if line == '': done = 1 else: print line, fd.close() I dont like that flag of "done",then I tried to re-write it as: fd = open

Re: problem with the logic of read files.. Thanks to all for your help

2005-04-12 Thread m_tach
Everything is fine now, thanks to all for your time -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with the logic of read files

2005-04-12 Thread Tom Jenkins
You may also be interested in the biopython project: http://www.biopython.org/ tom -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with the logic of read files

2005-04-12 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: #!/cbi/prg/python/current/bin/python # -*- coding: iso-8859-1 -*- import sys import os from progadn import * ... for x in extseq: f = open(x, "r") seq=f.read() f.close() s=seq def checkDNA(seq): ... seq=checkDNA(seq) print seq You terminated the loop

Re: problem with the logic of read files

2005-04-12 Thread gry
<[EMAIL PROTECTED]> wrote: > I am new to python and I am not in computer science. In fact I am a biologist and I ma trying to learn python. So if someone can help me, I will appreciate it. > Thanks > > > #!/cbi/prg/python/current/bin/python > # -*- coding: iso-8859-1 -*- > import sys > import os >

problem with the logic of read files

2005-04-12 Thread m_tach
I am new to python and I am not in computer science. In fact I am a biologist and I ma trying to learn python. So if someone can help me, I will appreciate it. Thanks #!/cbi/prg/python/current/bin/python # -*- coding: iso-8859-1 -*- import sys import os from progadn import * ab1seq = raw_input