Internal Variables

J

James Colannino

Hey everyone. I hope I have my terminology right, because I'm not quite
sure what to call them. I was just wondering how I can find information
in internal variables (for example - and I'm just making this up -
__version__ to give me the version of Python.) The only reason I ask is
that I'm trying very hard to search for information and can't find
anything. Perhaps the information I'm looking for isn't even contained
in variables but rather some other sort of object. Basically, I just
want to know how from within a script I can get information about the
python interpreter that I'm running. Thanks in advance.

James

--
My blog: http://www.crazydrclaw.com/
My homepage: http://james.colannino.org/

"A well regulated militia being necessary to the security of a free
state, THE RIGHT of the people to keep and bear arms SHALL NOT BE
INFRINGED." --United States Constitution, Second Ammendment
 
L

Larry Bates

What you want are attributes of sys object.

import sys
print sys.version

-Larry Bates
 
L

Larry Bates

What you want are attributes of sys object.

import sys
print sys.version

-Larry Bates
 
D

Daniel Evers

Hi!

The sys module provides some useful information, e.g.:

builtin_module_names -- tuple of module names built into this interpreter
version -- the version of this interpreter as a string
version_info -- version information as a tuple
hexversion -- version information encoded as a single integer
copyright -- copyright notice pertaining to this interpreter
platform -- platform identifier
executable -- pathname of this Python interpreter
prefix -- prefix used to find the Python library
exec_prefix -- prefix used to find the machine-specific Python library

(from sys.__doc__)
Maybe you can start searching there.

Daniel
 
S

Steven D'Aprano

Hey everyone. I hope I have my terminology right, because I'm not quite
sure what to call them. I was just wondering how I can find information
in internal variables (for example - and I'm just making this up -
__version__ to give me the version of Python.) The only reason I ask is
that I'm trying very hard to search for information and can't find
anything.

I find that there are many sources of information, such as books,
libraries, and television documentaries. Perhaps if you tell us what sort
of information you are after, we can suggest where you should be looking,
rather than just assume it is hidden in "internal variables".

BTW, since Python is open source software, you can download and read
through the entire code base if you wish.
 
P

Paul Rubin

James Colannino said:
Basically, I just want to know how from within a script I can get
information about the python interpreter that I'm running. Thanks in
advance.

import sys
print sys.version
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top