What is sys. argv?

Source: Internet
Author: User
Program Report! In the concise python tutorial, we can see a short section. importsys is followed by "foriinsys. argv". Where does sys. argv come from? In addition, sys. argv [0] is "we", and sys. argv [1] is "are ". Where did this come from? Did you write it yourself? Where? All the teachers laughed at me! I can see a short section in the python concise tutorial. After the import sys, I wrote "for I in sys. argv". Where does sys. argv come from? In addition, sys. argv [0] is "we", and sys. argv [1] is "are ". Where did this come from? Did you write it yourself? Where? The teachers laughed at me... reply: sys is a "standard library" of Python, which is an official "module". It is short for "System" and encapsulates some System information and interfaces, official Document Stamp: 27.1. sys-System-specific parameters and functions For details about the Chinese version, refer to [python] sys module.

I copied the source code in the Tutorial:

#!/usr/bin/python# Filename: using_sys.pyimport sysprint 'The command line arguments are:'for i in sys.argv:    print iprint '\n\nThe PYTHONPATH is', sys.path, '\n' 
How to run the python file *. py with parameters in IDLE to answer the question:
1. First open python_shell and the following screen appears.
2. Click File in the upper left corner to open the py File to be called.
3. A new dialog box is generated ,. Click run to view the result in shell. 3. A new dialog box is generated ,. Click run to view the result in shell.

4. Results:

Well, that's it. You should be careful enough.
Above.

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.