[EMAIL PROTECTED] wrote: >> 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> >> > No,that's not what I need... > When this function detect ";" or ":" ,it must append character "\n" or > "\n\t" ahead ":" or ";" another e.g > > 1) text="Hello world;Hello:Hello2" > > 2) When function detect ";" or ":" it must append character "\n" or "\n > \t" ahead ":" or ";", so that must look like this: > > NEW TEXT : "Hello world;\nHello:\n\t\t\n\n\n\n\n\nHello2" > > Isn't that what I said?
Please note that appending "\n" to ";" is the very same thing as replacing ";" with ";\n". Also note that the your description of the desired behavior does not match your example. You say "append "\n\t" after ":"", but thats not what happens in your example. There you append "\n\t\t\n\n\n\n\n\n" instead of "\n\t". That is confusing to me. Can you explain? /W -- http://mail.python.org/mailman/listinfo/python-list