Question: Python's argparse lets me define argument names containing a dot in the name. But how can I access these ?

```
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("inputfile.txt")
parser.add_argument("outputfile.txt")

args = parser.parse_args(['hello', 'world'])

# now args is:
# Namespace(inputfile.txt='hello', outputfile.txt='world')

# and this does not work
print(args.inputfile.txt)
>>> AttributeError: 'Namespace' object has no attribute 'inputfile'

```

Obviously attribute names can be created with a dot in their name but how can these be accessed ?

Edit:
My goal was to let argparse display the inputfile.txt name (e.g. with --help) but call the attribute "inputfile".

After trying some of the suggestions the easiest way to accomplish this is using the metavar option:

```
parser.add_argument("inputfile", metavar="inputfile.txt")

```

Answer: 
Rename the argument to `inputfile` and use `metavar` to set the display value for the user.

```
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("inputfile", metavar = "inputfile.txt")
parser.add_argument("outputfile", metavar = "outputfile.txt")

args = parser.parse_args(['hello', 'world'])

# now args is:
# Namespace(inputfile='hello', outputfile='world')

print(args.inputfile)

```
Using the dest option, you can assign it to anything:

```
parser = argparse.ArgumentParser()
parser.add_argument("inputfile.txt", dest='infile')
parser.add_argument("outputfile.txt", dest='out')

args = parser.parse_args(['hello', 'world'])
# now args is:
# Namespace(infile='hello', out='world')

```

Hope that helps.