Ich erhalte den folgenden Fehler, wenn ich versuche, expensedate
zu drucken.TypeError: nicht unterstützte Operandentypen für +: 'datetime.datetime' und 'str'
Traceback (most recent call last):
File "expense.py", line 36, in <module>
print_expense_month('nov16')
File "expense.py", line 31, in print_expense_month
print expensedate + " | " + description + " | " + "%.2f" % (cost)
TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'str'
Zeile 34 ist die print
Zeile unten. Ich möchte nur das Datum ausdrucken.
while description is not None:
expensedate = sheet.cell(row = i, column = COLUMN_DATE).value
description = sheet.cell(row = i, column = COLUMN_DESCRIPTION).value
cost = sheet.cell(row=i, column=COLUMN_COST).value
#expensedate format = 2016-11-01 00:00:00
if description is not None:
print expensedate + " | " + description + " | " + "%.2f" % (cost)
i = i + 1
Danke, arbeitete diese. – user1406716