Re: optparse escaping control characters

2008-08-19 Thread Hrvoje Niksic
Dan Halligan <[EMAIL PROTECTED]> writes: > How would I pass a control character to python on the command line? It depends on which command line you are using. Most Unix-like shells will allow you to input a control character by preceding it with ^V. Since \t is the TAB character, you should be a

Re: optparse escaping control characters

2008-08-19 Thread wannymahoots
Thanks for all the responses! -- http://mail.python.org/mailman/listinfo/python-list

Re: optparse escaping control characters

2008-08-19 Thread Steven D'Aprano
On Tue, 19 Aug 2008 05:35:27 -0700, wannymahoots 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? > Can this be prevented, or worked around? You are misinterpreting the evidence. Here's the short ex

Re: optparse escaping control characters

2008-08-19 Thread John Machin
On Aug 19, 10:35 pm, [EMAIL PROTECTED] 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? Can this be prevented, or worked around? > > This behaviour doesn't occur with non-control characters. > > For

Re: optparse escaping control characters

2008-08-19 Thread Dan Halligan
On Aug 19, 1:45 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > optparse seems to be escaping control characters that I pass as > > arguments on the command line.  Is this a bug?  Am I missing > > something?  Can this be prevented, or worked around? > > It has nothing t

Re: optparse escaping control characters

2008-08-19 Thread Fredrik Lundh
[EMAIL PROTECTED] 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 = {'d

Re: optparse escaping control characters

2008-08-19 Thread Hrvoje Niksic
[EMAIL PROTECTED] writes: > optparse seems to be escaping control characters that I pass as > arguments on the command line. Is this a bug? Am I missing > something? Can this be prevented, or worked around? It has nothing to do with optparse, it's how Python prints strings: $ python -c 'impor

optparse escaping control characters

2008-08-19 Thread wannymahoots
optparse seems to be escaping control characters that I pass as arguments on the command line. Is this a bug? Am I missing something? Can this be prevented, or worked around? This behaviour doesn't occur with non-control characters. For example, if this program (called test.py): from optparse