So, I have this is in my CSV file:
app,ceo,date,type
Youtube,Susan Wojcicki,2005,video sharing
Facebook,Mark Zuckerburg,2004,social networking
Google,Sundar Pichai,1998,search engine
Amazon,Jeff Bezos,1994,e-commerce
Apple,Tim Cook,1976,tech
This is the code:
data = open('companies.csv', 'w')
data.write(",".join(["Tesla", "Elon Musk", "2003", "automative"]))
data.close()
How do I write this piece of information into the CSV file without removing anything? Every time I run the program, the file just contains this piece of info. The rest of it disappears. I want to change to something like:
app,ceo,date,type
Youtube,Susan Wojcicki,2005,video sharing
Facebook,Mark Zuckerburg,2004,social networking
Google,Sundar Pichai,1998,search engine
Amazon,Jeff Bezos,1994,e-commerce
Apple,Tim Cook,1976,tech
Tesal,Elon Musk,2003,automotive