Pycharm添加函数说明文档

Pycharm 为函数添加函数文档注释

将光标移动到需要添加注释的函数名上后,会在左上角出现一个小灯泡的图标,点击后选择【Insert documentation string stub】,就能自动对函数的参数类型进行添加注释。

如果没有【Insert documentation string stub】选项,需要将File -> Settings -> Build,Execution,Deployment -> Python Debugger -> Collect run-time types information for code insight 和 File -> Settings -> Editor -> Smart Keys -> JSON -> Insert type placeholders in the documentation comment stub勾选上。