我向函數中添加了單個參數以及多個參數。我也移動了函數之外的變量,每次都會出錯。需要str()
嗎?在函數中存儲字符串的打印變量 - Python
def g_chord():
string_1 = "G note"
string_2 = "B note"
string_3 = "D note"
print "A 'G' chord consists of the 1st, 3rd, and 5th notes in the G scale. Those notes are a, %d, %d, and %d." % (string_1, string_2, string_3)
g_chord()
用'%s'替換'%d'' – MaximTitarenko