Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102171
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ben Finney <ben+python@benfinney.id.au> |
| Newsgroups | comp.lang.python |
| Subject | Re: how to get python version ? |
| Date | Thu, 28 Jan 2016 16:34:12 +1100 |
| Lines | 36 |
| Message-ID | <mailman.42.1453959261.2338.python-list@python.org> (permalink) |
| References | <76180516-f465-4fde-a1c4-920c91036623@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de 53rDcEWZD6F3YLqXD5NFEAvhpeY3DE8TDKRt/ut2NYsw== |
| Cancel-Lock | sha1:F4PlZ1hKA+Q5lGyNZSWzoQB5zDE= |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'string.': 0.04; 'sys': 0.05; 'sys.platform': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:version': 0.09; 'python': 0.10; 'jan': 0.11; 'subject:python': 0.14; '(2,': 0.16; '(3,': 0.16; 'comparisons,': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'structure.': 0.16; '>>>': 0.20; 'import': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'subject: ?': 0.27; 'question': 0.27; 'somebody': 0.30; "can't": 0.32; 'point': 0.33; 'url:python': 0.33; '8bit%:25': 0.33; 'lets': 0.33; 'running': 0.34; 'false': 0.35; 'something': 0.35; 'too': 0.36; 'there': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'received:org': 0.37; 'version': 0.38; 'to:addr:python.org': 0.40; 'url:3': 0.60; 'email addr:gmail.com': 0.62; 'more': 0.63; 'skip:\xe2 10': 0.70; '8bit%:27': 0.72; 'subject:get': 0.81; '5.3.1': 0.84; '_o__)': 0.84; 'amis': 0.84; 'received:125': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | jigong.madmonks.org |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:102171 |
Show key headers only | View raw
namenobodywants@gmail.com writes:
> is there something analogous to sys.platform that lets you get the
> version of python you're using? sorry if the question is too
> see-spot-run. thanks if you can help
The same ‘sys’ module provides many other ways to interrogate the
running Python system <URL:https://docs.python.org/3/library/sys.html>.
For the running version of Python, you want ‘sys.version_info’::
>>> import sys
>>> sys.version
'2.7.11 (default, Jan 11 2016, 21:04:40) \n[GCC 5.3.1 20160101]'
>>> type(sys.version)
<type 'str'>
>>> sys.version_info
sys.version_info(major=2, minor=7, micro=11, releaselevel='final', serial=0)
>>> type(sys.version_info)
<type 'sys.version_info'>
>>> sys.version_info > (3, 1)
False
>>> sys.version_info > (2, 5)
True
The ‘sys.version’ object is a human-readable string. If you actually
want to do comparisons, use ‘sys.version_info’ for its much more
fine-grained structure.
--
\ “If you can't annoy somebody there is little point in writing.” |
`\ —Kingsley Amis |
_o__) |
Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to get python version ? namenobodywants@gmail.com - 2016-01-27 21:21 -0800 Re: how to get python version ? Ben Finney <ben+python@benfinney.id.au> - 2016-01-28 16:34 +1100 Re: how to get python version ? Rustom Mody <rustompmody@gmail.com> - 2016-01-27 21:48 -0800 Re: how to get python version ? Chris Angelico <rosuav@gmail.com> - 2016-01-28 18:30 +1100 Re: how to get python version ? Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2016-01-28 17:02 +0000
csiph-web