Right now when I check this function, in export_incomes
if income_types in expenses:
TypeError: unhashable type: 'list'
I am not sure what I did wrong here.
I did create an incomes dictionary with income_types as key and income_value as value.
Iterates over the given incomes dictionary, filters based on the given income types (a list of strings), and exports to a file.
Exports the given income types from the given incomes dictionary to the given file.
def export_incomes(incomes, income_types, file):
final_list = []
for u, p in expenses.items():
if expense_types in expenses:
final_list.append(':'.join([u,p]) + '
')
fout = open(file, 'w')
fout.writelines(final_list)
fout.close()
If this is the income list that should be in txt if a user inputs stock, estate, work and investment, each should item and value should be on a separate line:
stock: 10000
estate: 2000
work: 80000
investment: 30000
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…