0
我有一個括號和quations圍繞我的打印語句,它看起來與我的其他打印語句相同,但我得到一個語法錯誤。哪裏不對? (這是最後的print語句中的代碼塊)奇怪的打印語法錯誤
def printSummary(itemRecords) :
# printSummary prints a summary from the itemRecords dictionary
print("ID NAME Start Available Reservations Subtractions End Stock")
print("--- ----- -------------- ---------- ----------- ---------")
for rec in itemRecords.values():
print("{0:5s} {1:12s} {2:6d} {3:6d} {4:6d} {5:6d}".format(rec.getID(), rec.getName(), rec.getAvailableStart(), rec.getReservations(), rec.getCancellations(), rec.getAvailableEnd())
#print the footer
print("------------------------------------------------------------------------------------")
檢查上次打印前行。 – tkausl
順便說一句,使用表格包。它會更整潔。 –
爲了跟上@tkausl稍微隱晦的評論,我還會建議你檢查你的代碼編輯器,看看它是否有一個匹配的支架突出顯示功能。 –