While loop help

Walter Hurry walterhurry at lavabit.com
Tue Apr 9 16:59:54 EDT 2013


On Tue, 09 Apr 2013 16:12:34 -0400, Dave Angel wrote:

> On 04/09/2013 03:35 PM, Walter Hurry wrote:
>> On Wed, 10 Apr 2013 02:10:29 +1000, Chris Angelico wrote:
>>
>>> On Wed, Apr 10, 2013 at 1:47 AM,  <thomasancilleri at gmail.com> wrote:
>>>> ... I'm not sure what version I'm using ...
>>>
>>> Try putting these lines into a Python script:
>>>
>>> import sys print(sys.version)
>>>
>> That works (of course), but in every Python version I've seen, one
>> merely needs to invoke the python interactive interpreter and the
>> banner is displayed:
>>
>> $ python Python 2.7.3 (default, Aug  9 2012, 17:23:57)
>> [GCC 4.7.1 20120720 (Red Hat 4.7.1-5)] on linux2 Type "help",
>> "copyright", "credits" or "license" for more information.
>>>>> quit()
>> $
>>
>>
> And if several are installed, that isn't necessarily the one that'll run
> when one runs a script.  Depends on how the script is invoked (and on
> what OS is running), and on the shebang line, PATH, etc.
> 
> The real point about those two lines is that they can be added to most
> scripts.

Well yes, but if multiple versions are installed and the script has a 
shebang, then invoking the same interpreter as the shebang does will 
produce the same result.

But this is dancing on the head of a pin anyway; OP just didn't know what 
version of Python he was running, so he is extremely unlikely to have 
more than one version installed, and to be choosing amongst them.




More information about the Python-list mailing list