Python by Swaroop C H - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

More sys

The sys.version string gives you information about the version of Python that you have installed. Thesys.version_info tuple gives an easier way of enabling Python-version specific parts of your program.

[swaroop@localhost code]$ python
>>> import sys
>>> sys.version
'2.3.4 (#1, Oct 26 2004, 16:42:40) \n[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)]' >>> sys.version_info
(2, 3, 4, 'final', 0)

For experienced programmers, other items of interest in the sys module include sys.stdin, sys.stdout andsys.stderr which correspond to the standard input, standard output and standard error streams of your program respectively.