On Wed, 2008-08-20 at 23:06 +0200, [EMAIL PROTECTED] wrote:
> 
> Message: 6
> Date: Wed, 20 Aug 2008 23:50:55 +0300
> From: "Dotan Cohen" <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] Reformatting phone number
> To: python-tutor. <tutor@python.org>
> Message-ID:
>         <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=UTF-8
> 
> I have gotten a bit farther, but I cannot get this to work as
> described in the previous mail:
> 
> #!/usr/bin/env python
> import sys
> preNumber =  sys.argv[1]
> if preNumber[0] == 0:

Python is strictly typed (unlike some languages like Javascript), you
cannot compare a string with a number although the string only contains
numbers. sys.argv[...] is a list of strings so preNumber[0] is a string,
while 0 is an integer.

>     number = '+972' + preNumber[1:]
> else:
>     number = '+' + preNumber
> 
> Where is my flaw?

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to