Why I need to add 5 backslash on the left if I want to show three of them in Python? How to count the backslash?
# [ ] print "\\\WARNING!///"
print('"\\\\\Warning///"')
最佳答案
您可以通过添加r
来使用“原始字符串”:
print(r'"\\\Warning///"')
这有助于避免反斜杠的“转义”属性,Python 使用该属性来控制特殊字符的使用
关于python - 我如何知道在Python中添加多少个反斜杠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45452219/