Get rid of n in Python
Get rid of n in Python
string n.strip();
or
string n.rstrip();
If, as Rolf suggests in his comment, you want to print text without having a newline automatically appended, use
print foo,
Note the trailing comma.
Get rid of n in Python
Get rid of just the n at the end of the line:
>>> string n.rstrip(n)
string
Get rid of all whitespace at the end of the line:
>>> string n.rstrip()
string
Split text by lines, stripping trailing newlines:
>>> line 1nline 2 nline 3n.splitlines()
[line 1, line 2 , line 3]