python中class或者methon的__doc__有多行时有'''\作为首行比较直观
'''\
Programming is fun
When the work is done
if you wanna make your work also fun:
use Python!
'''
这种方法也可以用于定义多行String
temp = '''\
Programming is fun
When the work is done
if you wanna make your work also fun:
use Python!
'''
Triple quotes are also an easy way to define a string with both single and double quotes
'''\
Programming is fun
When the work is done
if you wanna make your work also fun:
use Python!
'''
这种方法也可以用于定义多行String
temp = '''\
Programming is fun
When the work is done
if you wanna make your work also fun:
use Python!
'''
Triple quotes are also an easy way to define a string with both single and double quotes
本文介绍Python中使用三引号定义多行字符串的方法,包括如何在class或method的__doc__属性中使用,以及如何直接定义多行字符串。通过示例展示了三引号定义字符串的便捷性和直观性。
887

被折叠的 条评论
为什么被折叠?



