How do I create a csv file please anyone | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

How do I create a csv file please anyone

csv file

1st May 2022, 9:55 AM
Emeku Abel🇳🇬
Emeku Abel🇳🇬 - avatar
3 Answers
+ 3
Emeku Abel , python has a modul named csv that can be imported and then used. you can find the documentation and also some samples here: https://docs.python.org/3/library/csv.html
1st May 2022, 8:17 PM
Lothar
Lothar - avatar
+ 2
A csv file is a a simple text file. Create it like any other text file. The pandas module provides methods for writing csv files, too
1st May 2022, 9:59 AM
Lisa
Lisa - avatar
+ 2
The rules for writing CSVs are simple. Insert commas between output values. If you are writing strings, then replace any double quotes with two double quotes (" -> ""). Check each string to see whether it contains a comma. If so, then enclose the whole string inside double quotes. If there is no comma, then just write the string.
1st May 2022, 1:34 PM
Brian
Brian - avatar