因此,这里是它给我的错误我的程序片断..类型错误: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