1,760
edits
Changes
→Program Development and Testing
# review your working python code to see whether you can improve the interface of each function and facilitate better core re-use (this process is called refactoring).
== modules Modules you can use in your script for this assignment ==* the <b>os, sys</b> modules
* the <b>argparse</b> module
** [https://docs.python.org/3/howto/argparse.html Argparse Tutorial] - should read this first.
If there is one file name provided at the command line, read the login /logout records from the contents of the given file. The format of each line in the file should be the same as the output of 'last -Fiw'. Filter out incomplete login/logout record (check for the number of fields in each record).
If there is more than one file name provided, merges merge all the files together with the first one at the top and the last one at the bottom. Read and process the file contents in that order in your program.
=== Header ===
</pre>
== Program Suggested Script Development and Testing ==You should create The following python functions (to handle be created) are useful in handling the following sub-tasks:
* gets login records from the output of "last" command and filters out unwanted records
* reads login records from files and filters out unwanted records
* generate daily usage reports by user and/or by remote host* generate weekly usage reports by user and/or by remote host* generate monthly usage reports by user and/or by remote hostTo help you with this assignment, [[OPS435 A1 Usage Report Template|here is a template]] you can use as a starting point in developing your own Python Usage Report programscript.
Once you have finished coding a function, you should start a Python3 interactive shell, import your functions and manually call the function you want to testunder interactive mode.
Once you have all the individual function tested and that each is working properly, perform the final test with test data provided by your professor and verify that your program script produces the correct results before submitting your python program on Blackboard.
== Sample login records file and sample run ==