Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43235
| References | (3 earlier) <a530b25f-f9d9-45e9-925c-0ecd8a660cf6@googlegroups.com> <mailman.359.1365523839.3114.python-list@python.org> <kk1qiq$vpt$1@news.albasani.net> <mailman.385.1365538374.3114.python-list@python.org> <kk1vga$a0c$1@news.albasani.net> |
|---|---|
| Date | 2013-04-10 08:36 +1000 |
| Subject | Re: While loop help |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.390.1365546964.3114.python-list@python.org> (permalink) |
On Wed, Apr 10, 2013 at 6:59 AM, Walter Hurry <walterhurry@lavabit.com> wrote: > 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@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. I still went with a guaranteed-safe option. Adding those two lines to his script is sure to report on the Python being used to run the script, and it's not as if it's a massively-complex incantation :) > 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. Dunno about that. It's pretty easy to have two versions of something without understanding why. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
While loop help thomasancilleri@gmail.com - 2013-04-09 06:32 -0700
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 06:57 -0700
Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 13:12 -0400
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 10:18 -0700
Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 03:23 +1000
Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 13:30 -0400
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 06:58 -0700
Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 00:05 +1000
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 08:47 -0700
Re: While loop help Joel Goldstick <joel.goldstick@gmail.com> - 2013-04-09 12:02 -0400
Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 02:10 +1000
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:24 -0700
Re: While loop help Joel Goldstick <joel.goldstick@gmail.com> - 2013-04-09 12:36 -0400
Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 02:47 +1000
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:57 -0700
Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 03:08 +1000
Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 13:27 -0400
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:57 -0700
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:24 -0700
Re: While loop help Walter Hurry <walterhurry@lavabit.com> - 2013-04-09 19:35 +0000
Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 16:12 -0400
Re: While loop help Walter Hurry <walterhurry@lavabit.com> - 2013-04-09 20:59 +0000
Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 08:36 +1000
Re: While loop help rusi <rustompmody@gmail.com> - 2013-04-10 08:59 -0700
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 08:47 -0700
Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 00:00 +1000
Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:49 -0700
Re: While loop help Larry Hudson <orgnut@yahoo.com> - 2013-04-09 23:44 -0700
Re: While loop help Larry Hudson <orgnut@yahoo.com> - 2013-04-10 20:00 -0700
Re: While loop help jmfauth <wxjmfauth@gmail.com> - 2013-04-09 12:19 -0700
csiph-web