Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pass command line arguments in python

#https://towardsdatascience.com/3-ways-to-handle-args-in-python-47216827831a
import argparse

parser = argparse.ArgumentParser(description='Personal information')
parser.add_argument('--name', dest='name', type=str, help='Name of the candidate')
parser.add_argument('--surname', dest='surname', type=str, help='Surname of the candidate')
parser.add_argument('--age', dest='age', type=int, help='Age of the candidate')

args = parser.parse_args()
print(args.name)
print(args.surname)
print(args.age)
Source by www.pythonforbeginners.com #
 
PREVIOUS NEXT
Tagged: #pass #command #line #arguments #python
ADD COMMENT
Topic
Name
7+8 =