-2

Is there any way to print back slash in python? we can write a string in three format.
1. ASCII 2. Unicode 3. Raw String

I have tried with all 3 formats but not able to get expected result. Thanks in Advance

Adi81027
  • 51
  • 5

2 Answers2

3

Use double backslash, first one marks the escape character:

print("\\")
Netwave
  • 36,219
  • 6
  • 36
  • 71
0

First option - Unicode:

print('\u005c')

Second option:

print('\\')
Jakub Bláha
  • 1,301
  • 2
  • 19
  • 40