Shell command line, one-click creation of python Template File Script method, shellpython
When writing a python file, each file must start with a version and code. Every time I paste these two sentences after the touch file, I will be bored.
Because I have not installed python IDE tools, nor have I installed corresponding plug-ins for vim. I wrote this script to solve this problem, instead of relying on tools.
#! /Bin/baslif [-n "$1"]; then if [-f "$1"]; then echo $1 'file already exists, you cannot create 'else echo 'again '#! /Usr/bin/env python3'> $1 echo '#-*-coding: UTF-8-*-'> $1 echo $ 1' File Created successfully 'fielse echo' add new Python file name parameter 'fi
Save the script in ~ /. Bin directory, name it newpy, and then ~ /. Bin is added to the system environment variable, and then you can enter
Newpy test. py
Create a python script file with built-in annotations.
If you need more features, you can constantly enrich the shell script file. I didn't expect it for the moment. That's all ~ If you have a better method, please leave a message for me ~
In the preceding shell command line, the script method for creating a python template file with one click is all the content that I have shared with you. I hope you can provide a reference and support for the help house.