मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता १२

What is sys.argv? What does it contain? - Computer Science

Advertisements
Advertisements

प्रश्न

What is sys.argv? What does it contain?

थोडक्यात उत्तर

उत्तर

sys.argv is the list of command-line arguments passed to the Python program, argv contains all the items that come along via the command-line input, it’s basically an array holding the command-line arguments of the program.
To use sys.argv, you will first have to import sys. The first argument, sys.argv[0], is always the name of the program as it was invoked, and sys.argv[l] is the first argument you pass to the program (here it is the C++ file).

For example:
main(sys.args[1]) Accepts the program file (Python program) and the input file (C++ file) as a list(array). argv[0] contains the Python program which is needed not to be passed because by default _main_ contains source code reference and argv[l] contains the name of the C++ file which is to be processed.

shaalaa.com
Python Program to Import C++
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 14: Importing C++ programs in Python - Evaluation [पृष्ठ २८९]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 12 TN Board
पाठ 14 Importing C++ programs in Python
Evaluation | Q 5. | पृष्ठ २८९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×