import argparse
my_parser = argparse.ArgumentParser(description='this is an example')
my_parser.add_argument('-pattern', '--list', nargs='+',
help='choose the properties as you need:\n'
'including:\n'
'power, area, toggle, performance')
pattern = my_parser.parse_args().list
print('example exit')
When I type python help.py -h
in terminal, I found that '\n'
doesn't work:
D:\py_prj\try>python help.py -h
usage: help.py [-h] [-pattern LIST [LIST ...]]
this is an example
optional arguments:
-h, --help show this help message and exit
-pattern LIST [LIST ...], --list LIST [LIST ...]
choose the properties as you need: including: power,
area, toggle, performance
Why?