Skip to content

Instantly share code, notes, and snippets.

@yogeshsinghgit
Created October 2, 2022 14:23
Show Gist options
  • Save yogeshsinghgit/6f3e7b5ae17d1168c54d031d7fe9bf3f to your computer and use it in GitHub Desktop.
Save yogeshsinghgit/6f3e7b5ae17d1168c54d031d7fe9bf3f to your computer and use it in GitHub Desktop.
Reading CSV file
# 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