a simple string question
Wildemar Wildenburger
wildemar at freakmail.de
Fri Jul 27 13:29:58 EDT 2007
vedrandekovic at v-programs.com wrote:
> I have one question about string.I am trying to make an function to
> analyze line of some text, this is my example: "HELLO;HELLO2:WORLD:",
> if that function in this text find ";" and ":" ( in this example will
> find both)
>
> e.g that function must return this:
>
>
> "HELLO;\nHELLO2:\n\t\t\t\t\t\t\tWORLD:"
>
If I understand you correctly you want to replace ";" by ";\n" and ":"
by ":\n\t\t\t\t\t\t\t".
Well guess what? The replace() method does just this. Have a read:
<URL:http://docs.python.org/lib/string-methods.html>
/W
More information about the Python-list
mailing list