I am receiving arguments to my script such that the argument vector available to the script looks like the example below.
sys.argv = ["the/script/path.py", "--key1='value1'", "--key2='value2'", ... "--keyN='valueN'"]
I have no way of knowing what the key names will be. The end goal is to get a JSON map of all the key names to value name. I'm trying to figure out if there's a way to have the built in argparse library help with this. I understand that I can just do this manually by splitting the string in the list on equals, and removing the extra quote and dash characters.
As far as I can tell, you can use argparse to get unknown arguments, but I'm not seeing a clear way to automatically match the argument by name to the proper value after doing this. I just get a list of strings similar to the contents of sys.argv
Is there a clear method using the argparse library to convert the contents of my argument list to a JSON map of arguments to values?