The fundamentals...
Neil Schemenauer
nas at arctrix.com
Wed Jan 24 11:58:46 EST 2001
Its probably clearer use string.replace. Using ?!ng's excellent
pydoc command:
$ pydoc string.replace
Python Library Documentation: function replace in string
replace(s, old, new, maxsplit=-1)
replace (str, old, new[, maxsplit]) -> string
Return a copy of string str with all occurrences of substring
old replaced by new. If the optional argument maxsplit is
given, only the first maxsplit occurrences are replaced.
So you can do:
boo = string.replace(". ", "\n")
In Python 2.0 or later you can use string methods:
boo = boo.replace(". ", "\n")
Cheers,
Neil
More information about the Python-list
mailing list