user snippets
在VSCode左下角齒輪那里
選user snippets
出來以后選python
JSON里面加下面這一段
然后在.py文件輸入utf就會變成這個文件頭了
"utf file header": {
"prefix": "utf",
"body": [
"#!/usr/bin/python",
"# -*- coding: utf-8 -*-"
],
"description": "utf file header"
}
參考來源:https://www.zhihu.com/question/286332809/answer/450651657