How we import the CSV file in python code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How we import the CSV file in python code

5th Jul 2021, 6:45 AM
Girish Unde
3 Answers
+ 4
CSV files are comma separated values, you can use normal way for file handling, like with open("data.csv") as file: print(file.read()) Outputs will like - x, x, x......
5th Jul 2021, 6:49 AM
Abhiyantā
Abhiyantā - avatar
+ 2
Girish Unde , it is possible in certain cases to open and read the content. but if other (more complex) cases, it is better to use the python csv module. this can be imported like any other module. this module is also available in playground. find more information in the python docs: https://docs.python.org/3/library/csv.html
5th Jul 2021, 8:53 AM
Lothar
Lothar - avatar
+ 1
better to use openxl or numpy libraries to handle and work with CSV files. Much easier
5th Jul 2021, 7:27 AM
Shadoff
Shadoff - avatar