extracting numbers from a file, excluding fixed words
dawenliu at gmail.com
dawenliu at gmail.com
Sat Oct 29 16:22:55 EDT 2005
I've changed the code a little bit and works fine now:
inf = open('input.txt')
out = open('output.txt', 'w')
skips = [
'xxxxxxx xxxxxxxxxx xxxxx xxxxxxx',
'yyyyy yyyyyy yyy yyyyyy yyyyy yyy']
for line in inf:
flag = 0
for skip in skips:
if skip in line:
flag = 1
continue
if flag == 0:
out.write(line)
inf.close()
out.close()
More information about the Python-list
mailing list