Size: 453
Comment:
|
Size: 1241
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 10: | Line 10: |
= I/O = | |
Line 14: | Line 13: |
The modules sys and os provide the basic interface to the operating system. The module os creates a portable abstraction layer which is used by high-level modules, like glob, socket, thred, time, fcntl. |
|
Line 15: | Line 18: |
The module [[http://docs.python.org/lib/module-sys.html|sys]] provides access to system-specific parameters by the interpreter. === Example argv === {{{#!python #system1.py import sys print sys.argv }}} {{{ run system1.py parameter1 parameter2 ['system1.py', 'parameter1', 'parameter2'] }}} The script prints the command line arguments that are passed to the script. argv[0] is the script name A more sophisticated way of evaluating command line arguments is provided by the module [[http://docs.python.org/lib/module-optparse.html|optparse]] |
|
Line 30: | Line 51: |
= Input/Output = |
Interaction with the operating system
The modules sys and os provide the basic interface to the operating system. The module os creates a portable abstraction layer which is used by high-level modules, like glob, socket, thred, time, fcntl.
Module sys
The module sys provides access to system-specific parameters by the interpreter.
Example argv
run system1.py parameter1 parameter2 ['system1.py', 'parameter1', 'parameter2']
The script prints the command line arguments that are passed to the script. argv[0] is the script name
A more sophisticated way of evaluating command line arguments is provided by the module optparse
Module os