How do you pass a string as an argument in python without the output containing "Namespace".
Here is my code:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("person", help="person to test",type=str)
person = str(parser.parse_args())
print "The person's name is " + person
Here is the command I am running:
python test.py bob
This is my output:
The person's name is Namespace(person='bob')
I could probably do some fancy splitting, but I'm sure I'm just leveraging the argparse incorrectly(I'm new to python) if anyone can please tell me how to properly pass a string like this I would greatly apreciate it.
sys.argv[1]instead?