I have this code that manipulates many list (which are a mix of numbers and words) and I need it to print to a text file in rows without brackets. here is the code:
ingroup = open("C:\Python25\Drew\subgroup.txt", 'r')
outgroup = file ("dID.txt", 'w')
ct = 1
rcw = ingroup.readlines()
cID=0
ID=[] #list
dID={} #dictionary
for record in rcw:
bird = str.split(record) # bird is a list now with
dID[bird[3]]=0
for eachid in dID:
dID[eachid]=ct
ct+=1
for record in rcw:
bird = str.split(record)
bird.insert(0,dID[bird[3]])
print >> outgroup, bird
The output looks like this, but I need it without the brackets:
[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']
thank you