0

Once I assign an indentation to a variable, how can I print that specific thing that I assigned ? For example, this prints whitespace

delim = "\t"
print(delim)

whereas I would like to print out \t. I do not want to assign delim to be "\\t"

Kong
  • 2,202
  • 8
  • 28
  • 56
  • Possible duplicate of [Display special characters when using print statement](https://stackoverflow.com/questions/6477823/display-special-characters-when-using-print-statement) – Sohaib Farooqi Jul 23 '18 at 09:10
  • By the way, that character is not called "indentation," though indentation is a result of pressing that key when typing code in a text editor. The character is called "tab" which is an abbreviation of "tabulation." – Rory Daulton Jul 23 '18 at 09:11

2 Answers2

6

print(repr(delim)) will have the desired output

T.Nel
  • 1,540
  • 2
  • 18
  • 34
0

This will work

delim = r"\t"
print(delim)
Agile_Eagle
  • 1,710
  • 3
  • 13
  • 32