How do you edit the default `__author__ = name` li

2020-08-22 06:35发布

问题:

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

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

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

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

回答1:

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.

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



回答2:

The menu path is now File > Settings > Editor > File and Code Templates. You might need to change it on multiple templates depending upon how many of your Python templates have this at the top.