Re: [Tutor] How to change the char in string for Python

2013-02-24 Thread Sudo Nohup
char = chr ( (ord(char)-ord('a')+2)%26 +ord('a')) result.append(char) result = "".join(result) print result Thanks, James On Sun, Feb 24, 2013 at 8:40 PM, Dave Angel wrote: > Both your later remarks are top-posted, ruining the sequence o

Re: [Tutor] How to change the char in string for Python

2013-02-24 Thread Sudo Nohup
Thanks for your help. I just found a webpage used for me: http://stackoverflow.com/questions/10017147/python-replace-characters-in-string That page provides some other solutions. Thanks! On Sun, Feb 24, 2013 at 7:47 PM, Asokan Pichai wrote: > On Feb 24, 2013 4:27 PM, "Sudo Nohup

Re: [Tutor] How to change the char in string for Python

2013-02-24 Thread Sudo Nohup
24, 2013 at 7:32 PM, Marco Mistroni wrote: > You can use replace instead? > On 24 Feb 2013 10:59, "Sudo Nohup" wrote: > >> Dear all, >> >> I want to change the value of a char in a string for Python. However, It >> seems that "=" does not work. &

[Tutor] How to change the char in string for Python

2013-02-24 Thread Sudo Nohup
Dear all, I want to change the value of a char in a string for Python. However, It seems that "=" does not work. Could you help me? Thanks! str = "abcd" result = [char = 'a' for char in str if char == 'c'] OR: str = 'abcd' for char in str: if char == 'a': char = 'c' OR: str = 'a