n00bie help with file input and parsing
Greg Fortune
lists at gregfortune.com
Sun May 11 14:45:54 EDT 2003
oops, forgot to strip off the quotes... The code should be
lines = open('input.txt', 'r').readlines()
for x in lines:
out = open('QH' + string.split(x, ',')[3][1:-1], + '.txt', 'a')
tmp = string.split(x, ',')
out.write(string.join([x[1:-1] for x in tmp], '\n'))
out.close()
Greg Fortune
Fortune Solutions
<snip>
>
> lines = open('input.txt', 'r').readlines()
> for x in lines:
> out = open('QH' + string.split(x, ',')[3], + '.txt', 'a')
> out.write(string.join(string.split(x, ','), '\n'))
> out.close()
>
More information about the Python-list
mailing list