root 发表于 2017-4-23 07:02:48

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
页: [1]
查看完整版本: Python中docstring的写法