Discuss / Python / 什么区别?

什么区别?

Topic source

孑儒犬

#1 Created at ... [Delete] [Delete and Lock User]

print(r'\n\\') File "<stdin>", line 1 print(r'\n\\') ^ SyntaxError: EOL while scanning string literal print(r'\\n\') \\n\

aLIEzzzzZ

#2 Created at ... [Delete] [Delete and Lock User]

print(r'\n\\')的结果应该是\n\\,而print(r'\n\\')是会报错的,因为print('\n\\')执行不了,右边的'被转义掉了。

aLIEzzzzZ

#3 Created at ... [Delete] [Delete and Lock User]

我想print(r'')的用法前提应该是print('')先可执行才行。

aLIEzzzzZ

#4 Created at ... [Delete] [Delete and Lock User]

更正一下,“而”字后面的print(r'\n\\')应该是print('r\\n\')


  • 1

Reply