python 2.7.12 on Linux behaving differently than on Windows

Chris Angelico rosuav at gmail.com
Mon Dec 5 13:21:42 EST 2016


On Tue, Dec 6, 2016 at 5:02 AM, BartC <bc at freeuk.com> wrote:
> If the syntax is:
>
>   program filespec
>
> or:
>
>   program filespec file
>
> how do you tell whether the last file in an argument list is the optional
> 'file', or the last file of the expansion of 'filespec'?

Why should you care? I have used shell globbing to pass precisely two
parameters to a program. More often, I use this syntax, which Windows
simply doesn't support:

ffmpeg -i some-really-long-file-name.{avi,mkv}

to convert a file from one format to another. And if the .mkv file
already exists, I can just use ".*" at the end, although that does
depend on them being in alphabetical order. The shell is predictable
and therefore useful. This trick is guaranteed to work, no matter what
program I'm using. On Windows, I have to hope that the program expands
these notations correctly.

ChrisA


More information about the Python-list mailing list