Somebody asked me how to expand a prior example with the static variables so
that it took arguments at the command line for the variables.
This example uses Python 3 new features in the
datetime package.
There’s a small trick converting the string
arguments to date data types. Here’s a quick example
that shows you how to convert the argument list into individual
date data type variables:
#!/usr/bin/python3
# include standard modules
import sys
from datetime import datetime
# Capture argument list.
fullCmdArguments = sys.argv
# Assignable variables.
beginDate = ""
endDate = ""
# Assign argument list to variable.
argumentList = fullCmdArguments[1:]
# Enumerate through the argument list where beginDate precedes endDate as strings.
try:
for i, s in enumerate(argumentList):
if (i == …[Read more]