Using 'argparse' as opposed to sys.argv
问题 My script currently uses sys.argv to check for an input file provided to the program. I am trying to utilise argparse instead but I cant seem to get it to work. I was able to set it up and add an argument, but when I parse an argument, and print that parsed argument, I get a namespace. How can I get a string? Basically, I want to take the argument as a string, and open a file with that name. Currently, my sys.argv is: filename = sys.argv[1] f = open(filename, 'r') My argparse prints out a