Hey guys python newbie here, if I were to run the below code:
test = [['a', 'b', 'c'], ['a', 'b', 'c'], ['a', 'b', 'c'], ['a', 'b', 'c']]
with open('listfile.txt', 'w') as file:
for item in test:
for i in range(2):
file.write("%s" % item)
file.write("\n")
the text file looks like:
['a', 'b', 'c']
['a', 'b', 'c']
['a', 'b', 'c']
['a', 'b', 'c']
['a', 'b', 'c']
['a', 'b', 'c']
['a', 'b', 'c']
['a', 'b', 'c']
Any help on how I can make it look like this:
a b c
a b c
a b c
a b c
thanks in advance and please feel free to correct my coding.