1、单行注释用"#"号
# A comment ,this is so you can read your program later.
# Anything after the # is ignord by python
print ("I could have code like this.") #and the commnt after is ignored
# You can also use a comment to "disable" or commnt out code:
# print ("this won't run")
print ("This will run")
2、多行注释用三对引号
- 单引号
print ("以下为三对单引号注释多行,不会被运行")
'''
三对单引号,多行注释
三对单引号,多行注释
三对单引号,多行注释
'''
- 双引号
print ("以下为三对双引号注释多行,不会被运行")
"""
三对双引号,多行注释
三对双引号,多行注释
三对双引号,多行注释
"""
注意:三对双引号的另一用法
保持打印格式
print """
hahaah
hahahhahalfks
hjakfdksdhfakfhas
akjshfkjashfkjashfkajsd
"""
执行结果:
hahaah
hahahhahalfks
hjakfdksdhfakfhas
akjshfkjashfkjashfkajsd
喜欢点赞,有问题请留言
网友评论