Python中docstring的写法

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

你可能感兴趣的:(python)