Python3 教程 004 注釋

2021-08-18 18:45:32 字數 501 閱讀 9481

確保對模組, 函式, 方法和行內注釋使用正確的風格

python中的注釋有單行注釋和多行注釋:

python中單行注釋以 # 開頭,例如::

# 這是乙個注釋

print

("hello, world!"

)

多行注釋用三個單引號 ''' 或者三個雙引號 """ 將注釋括起來,例如:

#!/usr/bin/python3 

'''這是多行注釋,用三個單引號

這是多行注釋,用三個單引號

這是多行注釋,用三個單引號

'''print

("hello, world!"

)

#!/usr/bin/python3 

"""這是多行注釋,用三個雙引號

這是多行注釋,用三個雙引號

這是多行注釋,用三個雙引號

"""print

("hello, world!"

)

python筆記 004 注釋注釋

使用用自己熟悉的語言,在程式中對某些 進行標註說明,增強程式的可讀性 這是第乙個單行注釋 print hello python 為了保證 的可讀性,後面建議先新增乙個空格,然後再編寫相應的說明文字 print hello python 輸出 hello python 這是乙個多行注釋 在多行注釋之間...

python3注釋符號

python3 注釋 確保對模組,函式,方法和行內注釋使用正確的風格 python中的注釋有單行注釋和多行注釋 python中單行注釋以 開頭,例如 這是乙個注釋 print hello,world 多行注釋用三個單引號 或者三個雙引號 將注釋括起來,例如 1 單引號 usr bin python3...

python筆記 004 注釋

使用用自己熟悉的語言,在程式中對某些 進行標註說明,增強程式的可讀性 這是第乙個單行注釋 print hello python 為了保證 的可讀性,後面建議先新增乙個空格,然後再編寫相應的說明文字 print hello python 輸出 hello python 這是乙個多行注釋 在多行注釋之間...