Head First Python

Page 365

manage your data

def get_from_store(): all_athletes = {} try: with open('athletes.pickle', 'rb') as athf: all_athletes = pickle.load(athf) except IOError as ioerr: print('File error (get_from_store): ' + str(ioerr)) return(all_athletes) def get_names_from_store(): athletes = get_from_store() response = [athletes[each_ath].name for each_ath in athletes] return(response)

Remember: there’s no requirement to maintain the existing API.

you are here 4   329


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.