Python command-line argument learning (i)

Source: Internet
Author: User

It took so long to learn more about Python's command-line arguments, and was ashamed.

Reference article address: http://www.cnblogs.com/jianboqi/archive/2013/01/10/2854726.html

Your own code example:

#-*-coding:utf-8-*-__author__='Deen' " "Import Argparseparser = Argparse. Argumentparser () Parser.parse_args ( )" "" "Import Argparseparser = Argparse. Argumentparser () # Add parameter and Description parser.add_argument ("echo", help = "echo the string") args = Parser.parse_args () pri NT Args.echo" "ImportArgparseparser=Argparse. Argumentparser ()#Remember the description typeParser.add_argument ("Square", help="display a square of a given number", type=int) args=Parser.parse_args ()PrintArgs.square**2

Python command-line argument learning (i)

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.