On Jul 26, 4:30 pm, Steven D'Aprano wrote:
> On Mon, 26 Jul 2010 04:12:33 -0700, Chris Rebert wrote:
> > On Mon, Jul 26, 2010 at 4:03 AM, Sunny chilgod
> > wrote:
> >> Hi Chris,
> >> Thanks for your help. but i need to to convert the whole string to int.
> >> heres my full code,
> >> ptid = 'item
On Mon, 26 Jul 2010 04:12:33 -0700, Chris Rebert wrote:
> On Mon, Jul 26, 2010 at 4:03 AM, Sunny chilgod
> 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 ge
> On Mon, Jul 26, 2010 at 4:25 PM, Chris Rebert wrote:
>> On Mon, Jul 26, 2010 at 3:25 AM, lee wrote:
>> > Hi,
>> >
>> > I have a value,
>> >
>> > partintid = int(Screw plugg (91_10 -> untitled))
>> >
>> > but i get ValueError: invalid literal for int(): Screw plugg (91_10 -
>> >> untitled)
>>
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
On Mon, Jul 26, 2010 at 3:25 AM, lee wrote:
> Hi,
>
> I have a value,
>
> partintid = int(Screw plugg (91_10 -> untitled))
>
> but i get ValueError: invalid literal for int(): Screw plugg (91_10 -
>> untitled)
> any help?
That is most certainly not your actual exact code, since it has a few
Syn
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Terry Reedy wrote:
>> int(somestring) without a radix argument requires that somestring be an
>> decimal integer literal and nothing more and nothing else.
>
> but specifying a radix won't help you, though:
My stateme
Terry Reedy wrote:
> int(somestring) without a radix argument requires that somestring be an
> decimal integer literal
> and nothing more and nothing else.
but specifying a radix won't help you, though:
>>> int("1.0", 10)
Traceback (most recent call last):
File "", line 1, in ?
ValueError: i
"Martin MOKREJ©" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
int(somestring) without a radix argument requires that somestring be an
decimal integer literal and nothing more and nothing else.
>>> int('1')
1
>>> int('1.0')
Traceback (most recent call last):
File "", line 1, in
On 2005-02-14, Martin MOKREJ© <[EMAIL PROTECTED]> wrote:
> is this a bug or "feature" that I have to use float() to make int()
> autoconvert
> from it?
It's a feature. Integers don't have decimal points...
--
Grant Edwards grante Yow! I just had a NOSE
Martin MOKREJ© wrote:
> is this a bug or "feature" that I have to use float() to make int()
> autoconvert
> from it?
it's by design, of course. "1.00e+00" is not an integer.
if you want to treat a floating point literal as an integer, you have to
use an explicit conversion.
--
10 matches
Mail list logo