Discuss / Python / 大神看一下,我这个不转义中间的一点'''为何错误

大神看一下,我这个不转义中间的一点'''为何错误

Topic source

oneday9527

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

print(r''')

小灰晖543

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

被识别为以下情况了

如果字符串内部有很多换行,用\n写在一行里不好阅读,为了简化,Python允许用'''...'''的格式表示多行内容

oneday9527

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

你好,那我如何只打印出一个点‘呢?

print(r'''

'

''')

oneday9527

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

哇喔,非常感谢

24K醇天燃

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

print('.')这样不也行嘛?还要用r‘’‘ ‘’‘’’默认不转意嘛


  • 1

Reply