[問題] class問題
小弟最近剛學python 對於python很不熟悉
想寫一個可以存很多Account的class
class Account:
def __inti__(self, number, name, deposit, address):
self.account_id = number
self.account_name = name
self.deposit = deposit
self.address = address
acct = []
i = 0
acct[i].Account(number,name,deposit,address)
為什麼他說acct[i].Account(number,name,deposit,address)這行
IndexError: list index out of range
list不能這樣用嗎
請問我錯在哪裡
謝謝各位
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.122.184
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1449202387.A.338.html
→
12/04 12:20, , 1F
12/04 12:20, 1F
→
12/04 13:01, , 2F
12/04 13:01, 2F
→
12/04 13:02, , 3F
12/04 13:02, 3F
→
12/04 18:10, , 4F
12/04 18:10, 4F
→
12/04 18:11, , 5F
12/04 18:11, 5F
Python 近期熱門文章
PTT數位生活區 即時熱門文章