I'm trying to create a simple main function for a cheaper chess cryptography program, though I'm pretty sure how Configure all command line opt / arg stuff I want to configure the program to accept command line arguments in this way:
./ caesars.py -e 13 Encrypting To encrypt the message with
13 The number of changes and the following lines are the defined functions for me to be able to do, but I am not sure how to configure op ARG content to accept the first argument after argv [1], this is the key, after that Everything is to be divided into lists / long strings. Even if I have so far:
def main (): global decoder global encoder if not (sys.argv [1:]): use () # commandline read option: Except as a mistake, getopt.GetoptError: Except, Args = IOPT.Gettopy (sys.argv [1:], "HD: E:", ¬ ["Help", "Decode", "Encoded"]) O.O. ("-d", "- help") in print str (error) ("-d", "- decode"): use () in alif o: okode (decode =) in right alif o (" E "," --encode "): encoded = true second: emphasize the wrong," unwanted option "
Thank you in advance.
If you do not have it already, you should check it out. Although I have never used it myself, it is very popular and should be right for you.
No comments:
Post a Comment