因此,這裏是它給我的錯誤我的程序片斷..類型錯誤:int()函數的參數必須是字符串或數字,而不是「list'.Program給錯誤而轉換的unicode爲int
bob_phones={}
for lea in leadArray:
lead_id=(lea.lead_id).text
phone = (lea.phone_number).text
if phone not in bob_phones.keys():
new={phone:[lead_id]}
bob_phones.update(new)
for i in getPhonenumber(date):
if i not in bob_phones.keys():
status="Not in boberdoo"
lead_id="Not found"
#c.writerow([date,i,status,lead_id])
print str(date) + " | | " + i + " | | " + status + " | | " + lead_id
elif i in bob_phones.keys():
status = "Found in boberdoo"
lead_id=int(bob_phones[i])
#c.writerow([date,i,status,lead_id])
print str(date) + " | | " + i + " | | " + status + " | | " + str(lead_id)
#print missing_leads
return missing_leads
所以在else if語句中,我想用lead_id更新mysql表,但是它會提取但它不讓我將它從unicode轉換爲int,因爲我從字典中獲取該值。它給我這個錯誤。
TypeError: int() argument must be a string or a number, not 'list'.Program giving error while converting unicode to int.
任何人都可以建議我的替代方法。
感謝
拋出的錯誤是什麼? – George
對不起,喬治,我只是更新了它。 – Shubham