我遇到各種各樣的麻煩與此Python代碼,在編碼不是很好,但到目前爲止,這也水漲船高:它有排序「海峽」對象有沒有屬性「追加」
students = input("Students: ")
print('Class Roll')
myList = students.append()
myList.sort()
print(students[0])
print(students[1])
print(students[2])
print(students[3])
print(students[4])
名單在順序是:彭伊萬艾倫喬迪梅西
It comes back with this:
Traceback (most recent call last):
File "program.py", line 12, in <module>
myList = students.append()
AttributeError: 'str' object has no attribute 'append'
請幫助容易理解的語言,我需要有這個權利進步到下一輪的代碼。
'input'應該從用戶這是該類型海峽 –
你的意思'的輸入students.split()'? –