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培訓機構:千鋒教育。