Gabriel Genellina wrote:
>>> elif uniList[0].isdigit():
>>
>> The last does not work. Not only that it accepts numbers greater than 9
>> because it checks if the whole string consists of digits, it also accepts
>> u'²₂' and other unicode digits.
>
> Oh, I didn't know that last part! Thanks.
> I
Marc 'BlackJack' Rintsch ha escrito:
> In <[EMAIL PROTECTED]>, Gabriel
> Genellina wrote:
>
> > elif uniList[0].isdigit():
>
> The last does not work. Not only that it accepts numbers greater than 9
> because it checks if the whole string consists of digits, it also accepts
> u'²₂' and other unic
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Gabriel
> Genellina wrote:
>
>> At Monday 11/12/2006 07:22, [EMAIL PROTECTED] wrote:
>>
>>>elif int(uniList[0]) in range(0,10):
>>
>> Either of these will work to avoid an unneeded conversion:
>>
>> elif uniList[0] in "0123456789":
>>
In <[EMAIL PROTECTED]>, Gabriel
Genellina wrote:
> At Monday 11/12/2006 07:22, [EMAIL PROTECTED] wrote:
>
>>elif int(uniList[0]) in range(0,10):
>
> Either of these will work to avoid an unneeded conversion:
>
> elif uniList[0] in "0123456789":
>
> elif uniList[0] in string.digits:
>
> elif u
At Monday 11/12/2006 07:22, [EMAIL PROTECTED] wrote:
elif int(uniList[0]) in range(0,10):
Either of these will work to avoid an unneeded conversion:
elif uniList[0] in "0123456789":
elif uniList[0] in string.digits:
elif uniList[0].isdigit():
--
Gabriel Genellina
Softlab SRL
__
John Machin skrev:
> [EMAIL PROTECTED] wrote:
> > >>> v = raw_input("Enter: ")
> > Enter: kjjkj
> > >>> int(v)
> > Traceback (most recent call last):
> > File "", line 1, in
> > ValueError: invalid literal for int() with base 10: 'kjjkj'
> >
> > In my program I need to be able to enter char st
[EMAIL PROTECTED] wrote:
> >>> v = raw_input("Enter: ")
> Enter: kjjkj
> >>> int(v)
> Traceback (most recent call last):
> File "", line 1, in
> ValueError: invalid literal for int() with base 10: 'kjjkj'
>
> In my program I need to be able to enter char strings or int strings on
> the command
In <[EMAIL PROTECTED]>, aine_canby
wrote:
> elif uniList[0].lower() in ("p","pass"):
> break
> elif int(uniList[0]) in range(0,10):
Replace this line with:
elif uniList[0].isdigit() and 0 <= int(uniList[0]) < 10:
> verb.SetImportance(int(uniList[0]))
> break
> else:
>
>>> v = raw_input("Enter: ")
Enter: kjjkj
>>> int(v)
Traceback (most recent call last):
File "", line 1, in
ValueError: invalid literal for int() with base 10: 'kjjkj'
In my program I need to be able to enter char strings or int strings on
the command line. Then I use an if-elif structure to es