您可以使用转义字符停止python的另一种方法是使用原始字符串,如下所示:
>>> print(r"abcndef")abcndef
要么
>>> string = "abcndef">>> print (repr(string))>>> 'abcndef'
使用的唯一问题
repr()是它将字符串放在单引号中,如果您想使用引号可以很方便

您可以使用转义字符停止python的另一种方法是使用原始字符串,如下所示:
>>> print(r"abcndef")abcndef
要么
>>> string = "abcndef">>> print (repr(string))>>> 'abcndef'
使用的唯一问题
repr()是它将字符串放在单引号中,如果您想使用引号可以很方便