Social Media

7/28/2019

Command Line Arguments

Command line arguments are those arguments which are given by user at a screen, when we run the python script.
You cannot directly run these kinds of programs using your IDE normally.
You will have to import argv which is defined in sys package.
argv is a kind of list in which first element is the name of the file in which you have written the script.
You can give any number of arguments at command line. They will start going into list one by one.
You have to run these kind of programs using command prompts in windows or in linux it will be terminal where you are going to learn these kinds of scripts.
A simple script to multiply two numbers is given below.
Script: Write an script in Python to multiply two numbers which are given by user at prompt screen.

Be First to Post Comment !
Post a Comment