[Tutor] reading sequencies from text file

janos.juhasz at VELUX.com janos.juhasz at VELUX.com
Thu Aug 5 10:42:01 CEST 2004


Hi All,

I always had the same problem with python.
I want to assign value in condition, but it isn't valid in Python.

I want to write always like 

while (seq=fread(f, 4340))
{ fwrite(....);
}

But I could do just like this

f = open('K:/IT/gsm/mobilok.SPB')
e = open('K:/IT/gsm/mobilok.txt', 'wt')

while 1:
    actline = f.read(4340)
    if len(actline) == 4340:
        e.write(actline[:70])
        e.write('\n')
    else: break

f.close()
e.close()

Is it the pythonic way?


Yours sincerely, 
______________________________
János Juhász 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040805/a35e5c14/attachment.html


More information about the Tutor mailing list