Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to pass parameters in python script

#!/usr/bin/python

import sys

print 'Number of arguments:', len(sys.argv), 'arguments.'
print 'Argument List:', str(sys.argv)

# python scriptName.py arg1 arg2 arg3
# Output:
# Number of arguments: 4 arguments.
# Argument List: ['test.py', 'arg1', 'arg2', 'arg3']
Comment

PREVIOUS NEXT
Code Example
Python :: Python Roman to Integer method 2 
Python :: what is module in python 
Python :: finding odd even python 
Python :: install aws sdk python 
Python :: python sort the values in a dictionaryi 
Python :: python pow 
Python :: find all subsequences of a list python 
Python :: np.arange and np.linspace difference 
Python :: django q objects 
Python :: django active link 
Python :: square root in python 
Python :: python while false loop 
Python :: iterate over classes in module python 
Python :: how to convert dataframe to text 
Python :: How to select parts of a numpy array 
Python :: How to create role discord.py 
Python :: pandas description of dataframe 
Python :: remove space characters from string in python 
Python :: python for/else 
Python :: how to use setattr Python 
Python :: seed python 
Python :: xticks and yticks matplotlib 
Python :: dataframe python unique values rows 
Python :: pip uninstalled itself 
Python :: turn characters to alpgabetic numper python 
Python :: get keys from dictionary python 
Python :: python loop through dictionary 
Python :: group by 2 unique attributes pandas 
Python :: factors for negative number python 
Python :: pandas get outliers 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =