ValueError: invalid literal for int():

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Jul 26 07:30:31 EDT 2010


On Mon, 26 Jul 2010 04:12:33 -0700, Chris Rebert wrote:

> On Mon, Jul 26, 2010 at 4:03 AM, Sunny chilgod <san82moon at gmail.com>
> wrote:
>> Hi Chris,
>> Thanks for your help. but i need to to convert the whole string to int.
>> heres my full code,
>> ptid = 'item_01bom'
>> so item_01bom is a field name in form, so i get its value, partintid =
>> int(form[ptid]).  # the value of form[ptid] is 'Screw plugg
>>  (91_10 - untitled)'
>> Hence i get the error. hope i am clear now.
> 
> Nope, still vague. Which is your desired value for partintid: 91? 10?
> 9110? "91_10"? Something else?


Well, if you interpret 'Screw plugg (91_10 - untitled)' as a base-256 
number, the correct answer is:

147,334,663,384,405,567,160,096,068,524,905,866,724,622,858,761,848,595,862,392,584,788,047,651,881


Obviously.



-- 
Steven



More information about the Python-list mailing list