本文介绍了如何在 PyCharm 中编辑默认的 `__author__ = name` 行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 pycharm 中,当创建一个新的Python 文件"时,它默认有一些内容:__author__ = 'david'.

In pycharm, when making a new "Python File" it has some content by default: __author__ = 'david'.

我想做的是通过以下shebang更改此默认内容:

What I want to do, is changing this default content by the following shebang:

#!/usr/bin/env python
#-*- coding: utf-8 -*-

这样,在pycharm上打开新的python文件时,上面的内容就已经有了.这该怎么做?

This way, when opening new python files on pycharm, this content above will already be there. How to do this?

推荐答案

在 PyCharm 中,转到 首选项 > IDE 设置 > 文件和代码模板,然后单击 Python 脚本模板并将其从默认设置更改为您想要的任何内容.

In PyCharm, go to Preferences > IDE Settings > File and Code Templates and then click on the Python Script template and change it from the default to whatever you want.

感谢您的提问,我一直认为 __author__ = blah 很烦人,但从未花时间学习如何解决它.

Thanks for the question, I always thought the __author__ = blah was annoying but never took the time to learn how to fix it.

这篇关于如何在 PyCharm 中编辑默认的 `__author__ = name` 行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 22:30