Wierd problem with replace

wes weston wweston at att.net
Mon Mar 29 10:46:45 EST 2004


Florian Lindner wrote:
> Hello,
> I've this code:
> 
>     print "Login1:", login
>     login.replace("@","_")
>     print "Login2:", login
> 
> Which produces this output:
> 
>     Login1: tester at root
>     Login2: tester at root
> 
> Why is Login2 still tester at root and not tester_root? I thought that I've
> replaced the @ with _??
> 
> Thx,
> Florian
> 

Florian,

 >>> x = "tester at root"
 >>> y = x.replace("@","_")
 >>> print y
tester_root




More information about the Python-list mailing list