我正在做一个测验,但它一直说str object not callable im guess,因为我已经重新分配了songn和guess,但我不知道该怎么改
songn = str(song.readlines()[randNum]) #to match song line with artist
reader= csv.reader(f)
for row in reader:
print (songn[0]) #prints first letter of random song
artist = open("artistList.csv", "rt")
artistname = artist.readlines()[randNum] #to match song line with artist
print(artistname)
artist.close()
total=2 #number of guesses
guess = input("What is the song called?\n> ").lower()
print("guess is '%s' and songn is '%s'"(guess,songn))
错误在这行
print("guess is '%s' and songn is '%s'"(guess,songn))
检查带有函数
print()
的行的语法print("guess is '%s' and songn is '%s'"(guess,songn))
应该在字符串和要打印的变量之间使用“%”
print("guess is '%s' and songn is '%s'" % (guess,songn))
相关问题 更多 >
编程相关推荐