vze4rx4y at verizon.net
Sat Aug 2 06:36:41 CEST 2003
"Tim Heaney" <theaney at cablespeed.com> wrote in message
news:87lluckewd.fsf at mrbun.watterson...
> faizan at jaredweb.com (Fazer) writes:
> > This works:
> > print string.replace(str, "\n", "<br>")
> > But I can't assign the result into a variable but only print it like
> > the code above.
> The return value is the string you want. So, rather than printing it,
> assign it to a variable. You can reuse str, if you like...
> str = string.replace(str, "\n", "<br>")
> Note that since str is a string, you can invoke its replace method
> str = str.replace("\n", "<br>")
> rather than the class method.
> I hope this helps,
"str" is the name of the builtin string type.
So, it is inadvisable to re-use "str" as a
More information about the Python-list