How to take the string from input of argparse and use it as an object
Clash Royale CLAN TAG #URR8PPP How to take the string from input of argparse and use it as an object I am trying to create a program that reads a string off an argparse input and uses that string to call a certain object and use that object for the rest of the function. #!/usr/bin/python import argparse class car: def __init__(self, color, year): self.color = color self.year = year Beatle = car("blue", 1973) parser = argparse.ArgumentParser() parser.add_argument("--vehicleType") args = parser.parse_args() print("This "+args.vehicleType+ " is nice") print("It was made:") print(2018-args.vehicleType.year) print("years ago") However, I keep getting back this error: Traceback (most recent call last): File "./test.py", line 17, in <module> print(2018-args.vehicleType.year) AttributeError: 'str' object has no attribute 'year' I think the program is reading args.vehicleTyp...