Writing a whole list AS SUCH to a text file in Python

In python I don't want to write every single element into a file but a whole list as such. That means the text file should look like this for example:

["elem1", "elem2", "elem3"]
["elem1", "elem2", "elem3"]
["elem1", "elem2", "elem3"]

This is one examples to write each element from a list into a text file (Writing a list to a file with Python). But I don't need this, as I said.

Can anyone help me?



Read more here: https://stackoverflow.com/questions/64402612/writing-a-whole-list-as-such-to-a-text-file-in-python

Content Attribution

This content was originally published by Morpheus at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: