注釋在編程中是很重要的部分。它能告訴你這段代碼是干什么用的,或者用來刪除一部分你暫時(shí)不需要執(zhí)行的代碼。下面演示的是如何在
python中使用注釋:
#Acomment,thisissoyoucanreadyourprogramlater.
#Anythingafterthe#isignoredbypython.
print"Icouldhavecodelikethis."#andthecommentafterisignored
#Youcanalsouseacommentto"disable"orcommentoutapieceofcode:
#print"Thiswon'trun."
print"Thiswillrun."
由上面可知,Python中的#是用來寫注釋的,而且一般是寫單行注釋。
以上內(nèi)容為大家介紹了python培訓(xùn)之井號怎么用,希望對大家有所幫助,如果想要了解更多Python相關(guān)知識,請關(guān)注IT培訓(xùn)機(jī)構(gòu):千鋒教育。