Created
October 2, 2022 14:23
-
-
Save yogeshsinghgit/6f3e7b5ae17d1168c54d031d7fe9bf3f to your computer and use it in GitHub Desktop.
Reading CSV file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# importing library | |
import csv | |
def readCSV(filename): | |
with open(filename, mode = 'r') as csvfile: # opeaning a file in read mode | |
file_contents = csv.reader(csvfile) # read data from csv file using csv.reader function | |
for data in file_contents: # print the data using a for loop | |
print(data) | |
# calling function | |
# readCSV('studentData.csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment