GNU Info

Info Node: (python2.1-lib.info)shlex

(python2.1-lib.info)shlex


Prev: cmd Up: Miscellaneous Services
Enter node , (file) or (file)node

Simple lexical analysis
=======================

Simple lexical analysis for UNIX shell-like languages.  This module was
written by Eric S. Raymond <esr@snark.thyrsus.com>.
This manual section was written by Eric S. Raymond
<esr@snark.thyrsus.com>.
_Added in Python version 1.5.2_

The `shlex' class makes it easy to write lexical analyzers for simple
syntaxes resembling that of the UNIX shell.  This will often be useful
for writing minilanguages, e.g. in run control files for Python
applications.

`shlex([stream[, file]])'
     A `shlex' instance or subclass instance is a lexical analyzer
     object.  The initialization argument, if present, specifies where
     to read characters from. It must be a file- or stream-like object
     with `read()' and `readline()' methods.  If no argument is given,
     input will be taken from `sys.stdin'.  The second optional
     argument is a filename string, which sets the initial value of the
     `infile' member.  If the stream argument is omitted or equal to
     `sys.stdin', this second argument defaults to "stdin".

See also:
     Note: ConfigParser Parser for configuration files similar to the
     Windows `.ini' files.

shlex Objects

automatically generated by info2www version 1.2.2.9