python中的註釋規則以及中文註釋

單行註釋:#

多行註釋:三個單引號或者三個雙引號

 

 

另外注意如果代碼中有中文註釋,需要在代碼頭規定編碼格式:

# -*- coding: <utf8> -*-

否則會出現意想不到的錯誤

#!/usr/bin/python
# -*- coding: <utf8> -*-

#this is an annotation

'''
this is an annotation
this is an annotation
'''

"""
this is an annotation
this is an annotation
"""

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章