看板 Python 關於我們 聯絡資訊
tt9_ltd=[ [20140731, -43924], [20140801, -46905], [20140804, -51594], [20140805, -46340], [20140806, -51764], [20140807, 10000] ] def enter_pnl(): date_list=[] for tt in tt9_ltd: {date_list.append(tt[0])} input_date=input("Please enter today's Date yyyymmdd: ") input_pnl=input("Please enter today's PnL xxxx: ") if int(input_date) in date_list: { print("Date already exists. Overwriting....") tt9_ltd.pop(date_list.index(int(input_date))) tt9_ltd.append([int(input_date),int(input_pnl)]) } else: { tt9_ltd.append([int(input_date),int(input_pnl)]) } return(tt9_ltd) // 請問黃色那兩行為何會導致錯誤/停止compiler? 新手發問,感激不盡~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.129.149.150 ※ 文章網址: http://www.ptt.cc/bbs/Python/M.1407325220.A.425.html
LiloHuang:你是用 Python with Braces 嗎 XD 不然怎會有大括號出現 08/06 20:19
flarehunter:改用dict比較好吧 08/06 21:36
Neisseria:試了一下,你的程式可以跑,要不要把錯誤訊貼上來? 08/06 22:34