Python Beginner needs help with for loop
gagsl-py2 at yahoo.com.ar
Sun Feb 10 07:47:27 CET 2008
En Sun, 10 Feb 2008 04:06:54 -0200, ty.kresher at gmail.com
<ty.kresher at gmail.com> escribi�:
> I need to replace s2 = s.replace(c,"!") with a for loop function
> I don't really see how a for loop would iterate through the string and
> replace the character, and would like to see an example if possible.
Try starting with an empty string, and building the output one character
at a time (s = s + x); when you are at the position to be replaced, use
the replacement character instead.
More information about the Python-list