Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pass argument to a py file

import sys

def hello(a,b):
    print "hello and that's your sum:", a + b

if __name__ == "__main__":
    a = int(sys.argv[1])
    b = int(sys.argv[2])
    hello(a, b)
# If you type : py main.py 1 5
# It should give you "hello and that's your sum:6"
Comment

PREVIOUS NEXT
Code Example
Python :: how to square each term of numpy array python 
Python :: open tiff image pyt 
Python :: sigmoid function numpy 
Python :: pandas groupby count unique rows 
Python :: tkinter execute function on enter 
Python :: how to use random in python 
Python :: Change date format on django templates 
Python :: converting parquet to csv python 
Python :: django secret key 
Python :: convert transformation matrix to pose ros 
Python :: how to downgrade a package python 
Python :: python loop every month datetime 
Python :: check iterable python 
Python :: python check if file has content 
Python :: if none in column remove row 
Python :: print(np.round(df.isnull().sum() / len(df), 2)) 
Python :: random matrix python 
Python :: getting dummies for a column in pandas dataframe 
Python :: check empty dataframe 
Python :: random chiece python 
Python :: find index of max value in 2d array python 
Python :: no module named base45 windows 
Python :: remove special characters from dictionary python 
Python :: pandas rename columns by position 
Python :: pandas plot use index as x 
Python :: dynamo scripts template 
Python :: truncate date to midnight in pandas column 
Python :: sort list of files by name python 
Python :: pandas number of observations 
Python :: read csv boto3 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =