line example - shows an unreasonably simple one that just prints the argv list for inspection example - pp \system\testargv py import sys print(sys argvrunning this script prints the command-line arguments listnote that the first item is always the name of the executed python script file itselfno matter how the script was started (see "executable scripts on unixon page :\pp \systempython testargv py ['testargv py' :\pp \systempython testargv py spam eggs cheese ['testargv py''spam''eggs''cheese' :\pp \systempython testargv py - data txt - results txt ['testargv py''- ''data txt''- ''results txt'the last command here illustrates common convention much like function argumentscommand-line options are sometimes passed by position and sometimes by name using "-name valueword pair for instancethe pair - data txt means the - option' value is data txt ( an input filenameany words can be listedbut programs usually impose some sort of structure on them command-line arguments play the same role in programs that function arguments do in functionsthey are simply way to pass information to program that can vary per program run because they don' have to be hardcodedthey allow scripts to be more generally useful for examplea file-processing script can use command-line argument as the name of the file it should processsee ' more py script (example - for prime example other scripts might accept processing mode flagsinternet addressesand so on parsing command-line arguments once you start using command-line arguments regularlythoughyou'll probably find it inconvenient to keep writing code that fishes through the list looking for words more typicallyprograms translate the arguments list on startup into structures that are more conveniently processed here' one way to do itthe script in example - scans the argv list looking for -optionname optionvalue word pairs and stuffs them into dictionary by option name for easy retrieval command-line arguments