Here's an example...
BEGIN TEST.PY
import sys
print "Original:", sys.argv
for arg in sys.argv:
arg = arg.strip('-\x93\x96') # add chars here you want to strip
print "Stripped:", arg
END TEST.PY
--
http://mail.python.org/mailman/listinfo/python-list
considering that all the command lines are in sys.argv, it's very
simple.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I think the lesson there is 'dont depend on getopt, write your own
> command line parser'. I always write my own, as it's so easy to do.
>
I suppose you built your own car so you could get out a bit, too? After
all, there's nothing tricky about a simple internal combust
[EMAIL PROTECTED] wrote:
> I think the lesson there is 'dont depend on getopt, write your own
> command line parser'. I always write my own, as it's so easy to do.
While I'll agree that getopt isn't ideal, I find optparse to be much better.
--
Benji York
--
http://mail.python.org/mailman/listinf
I think the lesson there is 'dont depend on getopt, write your own
command line parser'. I always write my own, as it's so easy to do.
--
http://mail.python.org/mailman/listinfo/python-list
MarkE wrote:
> The answer appears to be:
> An example command line for running the script was written in a word
> document. The "Autocorrect" (sic) feature in word replaces a normal
> dash
There is a lesson there I wish more people would learn: Word is not a
text editor. :)
--
Benji York
--
h
This was discovered after consultation with a colleague who shall
remain nameless but, well, nailed it basically.
The answer appears to be:
An example command line for running the script was written in a word
document. The "Autocorrect" (sic) feature in word replaces a normal
dash at least as I kno
I'm using getopt. I doubt getopt recognises \x96 as a command line
parameter prefix. I suppose I could iterate over sys.argv doing a
replace but that seems messy. I'd rather understand the problem.
That said, and me not understanding code pages that much, I chcp'd the
machines it works on both com
does it matter? Have it key off both "\x96" and "-".
--
http://mail.python.org/mailman/listinfo/python-list
I don't exactly know what is going on, but '\x96' is the encoding for
u'\N{en dash}' (a character that looks like the ASCII dash,
u'\N{hyphen-minus}', u'\x45') in the following windows code pages:
cp1250 cp1251 cp1252 cp1253 cp1254
cp1255 cp1256 cp1257 cp1258 cp874
Windows is clearly doing
I'm sure someone else has posted a similar problem but I can't find it,
nor the solution...
I have a python script which accepts a command line argument.
E.g.
python.exe myscript.py -n Foo
I build this as part of a package using distutils with the
bdist_wininst option on a Windows 2K (SP4) machin
11 matches
Mail list logo