如何给python代码快速添加注释

2023-12-13 16:40:15 网络知识 匿名

python代码快速添加注释的方法

选中要注释的代码,按下ctrl+注释。

实例

#----->1.用一对"""括起来要注释的代码:

"""

number=23

guess=int(raw_input('Enteraninteger:'))

ifguess==number:

print'Congratulations,youguessedit.'#Newblockstartshere

print"(butyoudonotwinanyprizes!)"#Newblockendshere

elifguess

"""

#----->2.用一对'''括起来要注释的代码块:

'''

print'No,itisalittlehigherthanthat'#Anotherblock

#Youcandowhateveryouwantinablock...

else:

'''

#----->3.选中要注释的代码,按下ctrl+注释:

#print'No,itisalittlelowerthanthat'

##youmusthaveguess>numbertoreachhere

#print'Done'

##Thislaststatementisalwaysexecuted,aftertheifstatementisexecuted

以上内容为大家介绍了如何给python代码快速添加注释,希望对大家有所帮助,如果想要了解更多Python相关知识,请关注IT培训机构:瀚银百科。

发表评论: