Python standard library Sys

Source: Internet
Author: User

1. Command-line Parameters SYS.ARGV

Let's start with the example in the first part of the Python language module and see what's in the SYS.ARGV.

1 # Filename:using_sys.py 2 Import SYS 3 4 i=05 for in sys.argv:6    Print ('sys.argv[%d]:%s'%(i,item))7    i=i+1

Output:

$python using_sys.py-param1-param2-param3sys.argv[0]: using_sys.pysys.argv[1]:-param1sys.argv[ 2]:-param2sys.argv[3]:-PARAM3

Do you think that under Linux, a command corresponds to a number of parameters. Now you can also implement one of these commands.

2. Standard input Sys.stdin

Has the same type as a readable file object.

3. Standard output Sys.stdout

Has the same type as a writable file object.

4. Standard error Stream Sys.stderr

5. Other

Sys.version provides installed Python version information

Python standard library Sys

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.