-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
  • 61
  • 6

2 Answers2

3

Use double backslash, first one marks the escape character:

print("\\")
Netwave
  • 40,134
  • 6
  • 50
  • 93
0

First option - Unicode:

print('\u005c')

Second option:

print('\\')
Jakub Bláha
  • 1,491
  • 5
  • 22
  • 43