Pycharm自動生成文件頭部註釋和函數註釋

文件頭部註釋

新建py文件後, 自動生成頭部註釋
Preferences | Editor | File and Code Templates(Windows 從Setting)

#!/usr/bin/env python3.6.5
# -*- coding: UTF-8 -*-
"""
Author: 林子
Date: ${DATE} ${TIME}
docs: ${END}

"""

文件頭註釋

函數自動註釋

定義函數/方法後,輸入三引號, 按回車, 自動填充參數的註釋及返回值

def test(a, b):
	"""
	test函數
	:param a: 字符串a
	:param b: 字符串b
	:return: None
	"""

直接回車無效的,查看設置
Preferences | Tools | Python Integrated Tools(Windows 從Setting)
Docstring format 選擇 reStructuredText 或者 epytext 樣式稍微不一樣

  • For reStructuredText: :param tags for each parameter declared in the function signature, and :return tag.
  • For epytext: @param tags for each parameter declared in the function signature, and @return tag.
    函數註釋
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章