I need to add a column to a list of strings and then print it back to a new text file without [] or "". I tried this below but it is not the result I wanted.
infile looks like this:
23 CL 006 2004 DBA8ORPU 41 8Y S0111P 2
53 CL 006 2004 LBA8PUYE 32 10Y S0111P 2
39 CL 006 2004 A8LGPUYE 10 TY S0111P 2
rcw = infile.readlines()
for record in rcw:
bird = str.split(record)
bird.insert(7,'0')
age=bird[6]
if age=='HY':
bird[7]='0.1'
elif age=='SY':
bird[7]='1'
elif age=='TY':
bird[7]='2'
else:
pass
print >> outfile, bird
The outfile looks like this, but I need it to look like the infile with the new column and no '' or []: