python 2.7.12 on Linux behaving differently than on Windows
MRAB
python at mrabarnett.plus.com
Sun Dec 4 18:48:33 EST 2016
On 2016-12-04 22:52, Steve D'Aprano wrote:
> On Mon, 5 Dec 2016 07:26 am, DFS wrote:
>
>> $python program.py column1=2174 and column2='R'
>
> Here is a simple script demonstrating the issue:
>
>
> # --- program.py ---
> import sys
> print "argv:", sys.argv
> print ' '.join(sys.argv[1:])
>
>
>
> I haven't tested it on Windows, but on Linux it behaves as you describe (and
> as Linux users will expect):
>
> [steve at ando ~]$ python program.py column1=2174 and column2='R'
> argv: ['program.py', 'column1=2174', 'and', 'column2=R']
> column1=2174 and column2=R
>
[snip]
On Windows:
py.exe program.py column1=2174 and column2='R'
gives:
argv: ['program.py', 'column1=2174', 'and', "column2='R'"]
column1=2174 and column2='R'
and:
py.exe program.py column1=2174 and column2="R"
gives:
argv: ['program.py', 'column1=2174', 'and', 'column2=R']
column1=2174 and column2=R
More information about the Python-list
mailing list