Advertisement
Sclafus

csv_reader

May 15th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. def csv_reader(filename):
  2.     ''' gives back a list of every element in the csv file  '''
  3.    
  4.     a = []
  5.     try:
  6.         with open(filename, "r") as csvfile:
  7.             for row in csvfile:
  8.                 tmp = row.split(";")
  9.                 a.append(tmp[0])
  10.     except FileNotFoundError:
  11.         print("Could not find file, please retry.")
  12.         main()
  13.     return a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement