159k views
4 votes
Can someone help me to write a python code to save list form python to CSV file please?​

1 Answer

5 votes

f = open("MyFileName.csv", "w")

lst = ["Hello", "Hi", "Bye"]

f.write(str(lst))

f.close()

I didn't necessarily know what you meant by list form. This program works for me in pycharm. I had to install the CSV plugin though. If you encounter any errors, I'll try my best to help you.

User Mathijs Segers
by
6.2k points