Home > Article > Backend Development > How to add default information to Pycharm template? How to add default information
The content of this article is to introduce how to add default information to Pycharm template? How to add default information. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
We use the python3. The text is commented out, why does it still report an error when using it??
The error is reported because we are using the python2 interpreter. The python2 interpreter does not recognize Chinese. The Chinese we wrote is commented out. But it is still Take a simple look. It will be unhappy if it finds something it doesn’t recognize
. In order to solve this problem, we need to add a sentence
# -*- coding: utf-8 -*-
to the head of the file to solve this problem. .But if we frequently use the python2 version, we need to write it every time. There is a way to solve this problem below. Let’s take a look at the renderings first:
Okay Okay, let’s practice quickly:
The first step is to find the file file and click
The second step is to find settings and click to enter
The third step is to find the Editor and click
Then you will find that it is empty, you only need to copy the content into it That’s it
##!/usr/bin/python3 ''' -*- coding: utf-8 -*- @Author : Meet @Time : ${DATE} ${TIME} @Software: ${PRODUCT_NAME} @File : ${NAME}.py '''
Then click Apply and click OK. When you click OK, the window will be closed. Now go and create a file and try it!
The above is the detailed content of How to add default information to Pycharm template? How to add default information. For more information, please follow other related articles on the PHP Chinese website!