How to use getopt

Note to myself : Always forgetting how to use getopt.

Easy simply use a list of options in the REPL console instead of sys.argv[1:]

: getopt.getopt('-a 1 -b b -c copt'.split(),'a:b:c:')[0]                                                                                                              
: [('-a', '1'), ('-b', 'b'), ('-c', 'copt')]

what about long options :

: getopt.getopt('-a 1 -b b --c copt'.split(),'a:b:',['c='])[0]                                                                                                        
: [('-a', '1'), ('-b', 'b'), ('--c', 'copt')]

check also : Parse cmdline opts as obj attributes