I am teaching myself Python with a book, and, in one of the assignments I need to make a program to strip whitespace before and after a variable. It also says to use the \n
and \t
escape characters.
I can get strip()
, lstrip()
and rstrip()
to work but \t
and \n
are giving me trouble.
Is there a way to use \t
on a variable?
I tried this:
name = " shane waxwing "
print(\tname)
It only works on strings, like this:
print("\tshane waxwing")