Is there a function in python that allows us to save a list in a txt file and keep its format?
If I have the list:
values = [\'1\',\'2\',\'3\']
Try this, if it helps you
values = ['1', '2', '3'] with open("file.txt", "w") as output: output.write(str(values))