我正在學習Python。在做練習時,我得到錯誤並非在字符串格式化過程中轉換的所有參數
Python TypeError: not all arguments converted during string formatting
我已經搜索了答案,但我不明白我找到的代碼。
print "What's your name?",
name = raw_input()
print "What's your middle name?",
middle_name = raw_input()
print "Where do you live?",
country = raw_input()
print "Make of the car you drive?",
car = raw_input()
print "Are you single or married?",
socstatus = raw_input()
print "Are you Men or Woman?",
sex = raw_input()
print "Let me see if I understood correctly. Your complete name is %r %r, you live in %r, rides on a %r, and you are a %r $r." % (name, middle_name, country, car, socstatus, sex)
你沒告訴我們你在說什麼錯誤 –
你最後的print語句用'$ r',而不是一個'%r' – yurib
結束我承認,代碼;你忽略了「酷」這個詞。 :) – zondo