本篇简要介绍下如何使用 PyCharm 设置默认的作者信息和脚本模板。

  PyCharm >> Preferences/Settings >> Editor >> File and Code Templates >> Python Script >> 设置内容 >> 点击 Apply。

PyCharm 设置作者注释及脚本模板

 

  可自定义作者信息和脚本模板,后续创建新的 python 脚本时,会自动生成如下脚本内容。

  可以把一些自己常用的基础代码设置成模板。

 

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : ${DATE}
# @Author  : starnight_cyber
# @Github  : https://github.com/starnightcyber
# @Software: ${PRODUCT_NAME}
# @File    : ${NAME}.py

import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import ssl
import time

# Do not support ssl and disable warning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
timestamp = time.strftime("%Y-%m-%d", time.localtime(time.time()))

def test():
    # write your code here
    pass


if __name__ == '__main__':
    test()
    pass

 

Refer ~ 

https://blog.csdn.net/u010105243/article/details/76154251

  

相关文章:

  • 2021-12-01
  • 2021-04-09
  • 2021-12-14
  • 2021-10-12
  • 2021-08-20
  • 2021-11-02
猜你喜欢
  • 2022-12-23
  • 2022-01-07
  • 2021-12-05
  • 2021-11-22
相关资源
相似解决方案