ValueError: invalid literal for int():

lee san82moon at gmail.com
Mon Jul 26 07:50:09 EDT 2010


On Jul 26, 4:30 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Mon, 26 Jul 2010 04:12:33 -0700, Chris Rebert wrote:
> > On Mon, Jul 26, 2010 at 4:03 AM, Sunny chilgod <san82m... 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

Hi,

i got the value wrong. sorry for the mistake. i get a int value like
"01", so no issue converting it to integer.
thanks.



More information about the Python-list mailing list