Python: ValueError: I/O operation on closed file on csv file -


when run following code:

def read_s_par_csv(file_name):      open(file_name,'r') csvdatafile:         csvreader = csv.reader(csvdatafile)          vg = []         vd = []          row in csvreader:             vg.append(row[0])             vd.append(row[1])      return vg,vd   if __name__ == '__main__':     vg,vd = read_s_par_csv('./s_par_test.csv')     print(vg) 

i following error

traceback (most recent call last):
file "..", line 201, in vg,vd = read_s_par_csv('./s_par_test.csv')
file "..", line 189, in read_s_par_csv row in csvreader: valueerror: i/o operation on closed file


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -