-3

suppose I want a command like
python test.py --layer 3 --sizes 100,100,100

where layer == len(sizes)
and sizes is a comma separated list

please help me with this command

Avyukth
  • 101
  • 1
  • 1
  • 4
  • 1
    Welcome to [so]! This is not a code writing service, please review [ask] and show us what you've tried. – TemporalWolf Feb 08 '18 at 20:16
  • If you specified `nargs='*'` for `--sizes` you skip the commas on input and splitting. And `type=int` could make sure they are numbers. – hpaulj Feb 08 '18 at 22:09

1 Answers1

0

Use argument parser from python : https://docs.python.org/3/library/argparse.html

You have examples in the doc.

Hint for your sizes: You can store it as a string and split it with ',' as a separator If sizes_string is "100,100,100", you do:

sizes = [int(s) for s in sizes_string.split(',')]
Adrien Logut
  • 812
  • 5
  • 13