Nov-06-2019, 11:29 PM
(This post was last modified: Nov-06-2019, 11:29 PM by fcktheworld587.)
In the following module, IDLE refuses to run it, siting "Keyword can't be an expression" and highlights the ( on the righthand side of AthleteList inside the get_coach_data function. What am I doing wrong? Edit: pycharm will run it with exit status 0
return(AthleteList(temp1.d=pop(0), temp1.pop(0), temp1))the following is the full module
import pickle from athletelist import AthleteList def get_coach_data(filename): try: with open(filename) as f: data = f.readline() temp1 = data.strip().split(",") return(AthleteList(temp1.d=pop(0), temp1.pop(0), temp1)) except Exception as ioerr: print("File error:" + str(ioerr)) return(None) def put_to_store(files_list): all_athletes = {} for each_file in files_list: ath = get_coach_data(each_file) all_athletes[ath.name] = ath try: with open('athletes.pickle', 'wb') as athf: pickle.dump(all_athletes, athf) except IOError as ioerr: print('File Error(put_and_store):' + str(ioerr)) return(all_athletes) def get_from_store(): all_athletes = {} try: with open('athletes.picle', 'rb') as athf: all_athletes = pickle.load(athf) except IOError as ioerr: print('File error (get_from_store) ' + str(ioerr)) return(all_athletes)