13 command line parameters in python

 '''

1. You can access to the command line parameters using the sys.argv 


 Example ::- command_line_argu.py "uma mahesh" 78

'''

import sys


## To get first command line argument

print(' argv[1] :: ' , sys.argv[1])


## To get second command line argument

print(' argv[2] :: ' , sys.argv[2])


## To get file name with full path

#print(' argv[0] :: ' , sys.argv[0])


## To get all command line argument with file name

#print(' argv :: ' , sys.argv)








Comments

Popular posts from this blog

1 PYTHON PROGRAMMING

16 file handling in python

4 Tuple data types