[問題] ValueError問題看不太懂
f = open("list.txt", "r")
count ={}
for line in f:
line = line.strip('\n')
(item, num) = line.split(',')
#print "%s --> %s" %(item,num)
if count.has_key(item):
count[item] = count[item]+int(num)
else:
count [item] = int(num)
split那行會跑出下面這個錯誤
ValueError: need more than 1 value to unpack
原本是在linux上跑的,我在windows打卻不能執行
也不需要輸入甚麼參數阿,我看不懂這邊是哪裡有問題
還請各位幫我看看,謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.127.233.24
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1553585685.A.88E.html
※ 編輯: andrew5106 (140.127.233.24), 03/26/2019 15:40:06
※ 編輯: andrew5106 (140.127.233.24), 03/26/2019 15:47:12
→
03/26 16:44,
6年前
, 1F
03/26 16:44, 1F
→
03/26 18:29,
6年前
, 2F
03/26 18:29, 2F
→
03/27 08:46,
6年前
, 3F
03/27 08:46, 3F
Python 近期熱門文章
PTT數位生活區 即時熱門文章