Shell command line, one-click creation of python Template File Script method, shellpython

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.