Sys module
- This is a built in library that provides variables and functinons to interact with the pytho runtime environment an interpreter
Commonly use features in sys module
Command-line arguments:
sys.argv => complete arguments
sys.argv[0] => script or python module
sys.argv[1:] => remaining arguments
- Consider the following python code
import sys
print(f"complete argv {sys.argv}")
print(f"script: {sys.argv[0]}")
print(f"args: {sys.argv[1:]}")
- Lets explore by running this

Exiting a Script
- Exiting as script
sys.exit() - 0 => success code and any other number is conisdered as failure
import sys
if (len(sys.argv) < 2):
sys.exit(1)
sys.exit(0)
module search path
-
sys.path is a list of strings that specifies where the python interpreter should look when you try to import a module
-
for others refer this notebook Refer Here
Lets build a todo list application
- Think of this as a small to-do list or a sticky-notes
- Except the
paperis a plain text file. -
this will be a cli application which does following
- add task
- list tasks
- remove/complete task
-
Refer Here for the changes
Adding additional behaviors
- To be discussed later
