You should escape it with another backslash \
:
print('\\')
A backslash needs to be escaped with another backslash.
print('\\')
do you like it
print(fr"\{''}")
or how about this
print(r"\ "[0])
A hacky way of printing a backslash that doesn't involve escaping is to pass its character code to chr
:
>>> print(chr(92))
\
Source: Stackoverflow.com