from flashcards.decks import create_deck_from_back_function # your choice of deck name and filename deck_name = 'Building Costs' deck_fname = 'building-costs' # specify the namelist to be used to create the deck # give the relative path of the file from config.namelists_dir namelist = 'buildings.txt' # key into json file specifying which data you want # uncomment either 'units_buildings' or 'techs' data_json_key = 'units_buildings' #data_json_key = 'techs' def card_back(num, name, data): cost = data[num]['cost'] back = '\n'.join([f'{res}: {val}' for res, val in cost.items() if val != 0]) return back create_deck_from_back_function(namelist, data_json_key, card_back, deck_name, deck_fname)