optparse escaping control characters
Fredrik Lundh
fredrik at pythonware.com
Tue Aug 19 08:57:49 EDT 2008
wannymahoots at gmail.com wrote:
> optparse seems to be escaping control characters that I pass as
> arguments on the command line. Is this a bug? Am I missing
> something?
you're missing the distinction between the content of a string object,
and how the corresponding string literal looks.
>>> x = {'delimiter': '\\t'}
>>> x
{'delimiter': '\\t'}
>>> x["delimiter"]
'\\t'
>>> print x["delimiter"]
\t
>>> len(x["delimiter"])
2
</F>
More information about the Python-list
mailing list