I am trying to print to a file that will look like:
'A'
'1'
'B'
'2'
'C'
'3'
Given the code below, however, the result is :
['A']
['B']
['C']
This is probably a 'softball' question, but what am I doing wrong here?
l1 = ['1']
l2 = ['A']
l3 = ['2']
l4 = ['B']
l5 = ['3']
l6 = ['C']
listoflists = [l1,l2,l3,l4,l5,l6]
itr = iter(listoflists)
f = open ('order.txt','w')
while True:
try:
itr.next()
s = str(itr.next())
f.write(str('\n'))
f.write(s)
except StopIteration:
break
f.close()