不懂给python代码快速添加注释的方法?其实想解决这个问题也不难,下面让小编带着大家一起学习怎么去解决,希望大家阅读完这篇文章后大所收获。

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

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

实例

#----->1.用一对"""括起来要注释的代码:"""number=23guess=int(raw_input('Enteraninteger:'))ifguess==number:print'Congratulations,youguessedit.'#Newblockstartshereprint"(butyoudonotwinanyprizes!)"#Newblockendshereelifguess<number:"""#----->2.用一对'''括起来要注释的代码块:'''print'No,itisalittlehigherthanthat'#Anotherblock#Youcandowhateveryouwantinablock...else:'''#----->3.选中要注释的代码,按下ctrl+/注释:#print'No,itisalittlelowerthanthat'##youmusthaveguess>numbertoreachhere#print'Done'##Thislaststatementisalwaysexecuted,aftertheifstatementisexecuted

感谢你能够认真阅读完这篇文章,希望小编分享给python代码快速添加注释的方法内容对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,遇到问题就找亿速云,详细的解决方法等着你来学习!