下面是一些python3代碼和它,我無法找出錯誤:找不到在簡單的Python代碼:(錯誤
httpurl = "http://okgift.ru/audio/Servantes/Don-Kihot/"
httpurl = string(httpurl)
mp3 = 1
mp3 = int(mp3)
ext = ".mp3"
ext = string(ext)
while mp3 < 332:
final = httpurl+mp3+ext
print(final)
mp3 = mp3+1
錯誤:
Traceback (most recent call last):
File "prog.py", line 2, in <module>
httpurl = string(httpurl)
NameError: name 'string' is not defined
而且在網上這樣: http://ideone.com/u0ZBo2
錯誤正是它所說的:沒有什麼叫'string'。你認爲'string'應該是什麼?你的意思是'str'? – BrenBarn
爲什麼要將給定類型的值賦值給var,然後再次將其轉換爲相同類型? – ddinchev