There was something like pickle
, but it seems to be a bug if there are numbers in it, so I will do it primitively.
data = [[1,2,3,4,5,6], [1,2,3,4,5,6]]
def c(data):
outputfile = open("./output.txt", "w")
for d in data:
if(len(d) == 6):
str_list = map(str, d)
write_data = ",".join(str_list)+"\n"
outputfile.write(write_data)
outputfile.close()
c(data)
result
output.txt
1,2,3,4,5,6
1,2,3,4,5,6
Point --Don't forget to close the file you used once --Convert all elements to String with map
Recommended Posts