572
edits
Changes
m
→Using argparse to Obtain Positional Arguments from the Command Line
<li>Add a second parser.add_argument line to your script so that you can also obtain the name of the directory to archive from the command line. You can choose if it should go before or after the name of the archive. Just remember to use a different argument name, and an appropriate help message.</li>
<li>Replace the line in your script that prompts the user for the name of the directory with code that will retrieve the value the user entered on the command line.</li>
<li>Run you your script to make sure it works.<br />
You should now be able to enter both the directory to archive, and the name of the resulting archive on the command line, and should only be prompted about compression.</li>
<li>All that is left to finish the script is to replace the prompts for compression with command line options. You could do this by adding a third argument and requiring it to include a compression type, or by creating a mutually exclusive group with three arguments in it (one for each compression type). Neither of these is more '''correct''' than the other. Pick which one you would like to try and finish the script with it.</li>