February 2013
Intermediate to advanced
304 pages
6h 45m
English
Instead of hardcoding your scripts with paths to specific datasets, you can make your scripts more flexible by allowing them to accept input in the form of parameters from the command prompt. These input parameters can be captured using Python's sys.argv[] object.
Python's sys.argv[] object
allows you to capture input parameters from the command line when a script is executed. An example is useful for illustrating how this works. Take a look at the following screenshot:

Each word must be separated by a space. These words are stored in a zero-based list object called sys.argv[]. With sys.argv[] ...
Read now
Unlock full access