Return to Snippet

Revision: 34133
at October 17, 2010 23:41 by kennym


Initial Code
# Given some text with newlines:
text = "hello\nworld\n!!!"

# Add a tab before every newline:
"\t" + text.replace("\n", "\n\t")

Initial URL

                                

Initial Description

                                

Initial Title
Add a \t at the beginning of each line

Initial Tags
python, replace, text

Initial Language
Python