[Tutor] Filter question
Kooser, Ara S
askoose at sandia.gov
Tue Apr 13 15:11:40 EDT 2004
Hello,
I am new to python. I am trying to covert one file type to another
(molecular dynamics output to visualizer input). I have set up the following
filter, but it is not working. I don't receive an error message just a blank
prompt at shell. Here is the code. I am trying to filter out any line the
begins with I. I am using python 2.3.3. Thanks.
Ara
def filterFile(lmps, out):
inp = open("lmps","r")
outp = open("out","w")
while 1:
text = inp.readline()
if line == "":
break
if line[0] == 'I':
continue
outp.write(line)
inp.close()
outp.close()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040413/aabf8e5a/attachment.html
More information about the Tutor
mailing list