[Head First Python]2. python of comment

时间:2023-04-09 21:38:25

1- 多行注释 ''' ''' 或 """ """

'''this is the standard way to include a

multiple-line comment in you code'''

"""this is the standard way to include a

multiple-line comment in you code"""

2- 单行注释 #

# this is comment

3- 中文注释

 #_*_ coding:utf-8 _*_
import nester
cast = ["hello","kitty",["world",["Jerry"]],"program",["Java","C"],"test"]
nester.print_lol(cast, True) #中文注释

中文注释文件第一行需要写入代码,告知python使用的编码方式

#_*_ coding:utf-8 _*_

reference:

http://15975604853.blog.163.com/blog/static/1182880352012116574235/