file object: seek and close?
Shu-Hsien Sheu
sheu at bu.edu
Thu Sep 18 12:39:26 EDT 2003
Here it is:
f = open(pdb, 'r')
type = 0
for lines in f:
if lines[:6] == 'TITLE':
type = 1
if lines[:6] == 'COMPND':
break
f.seek(0)
if type == 0:
list = pdbdict_0()
for lines in f:
...................................
if type==1:
list = pdbdict_1()
for lines in f:
So first the program use a criteria to check what type of the file is,
and then do different operations from the beginning of the file.
-shuhsien
>#- f = open('somefile', 'r')
>#- for lines in f:
>#- some operations
>#- f.seek(0)
>
>I think will be very useful if you detail what those "some operations" are.
>
>. Facundo
>
>
More information about the Python-list
mailing list