13

Quite simply, is there a python equivalent to php's phpinfo();? If so, what is it and how do I use it (a link to a reference page would work great).

aneroid
  • 12,287
  • 3
  • 38
  • 59
Frank V
  • 24,427
  • 32
  • 102
  • 143

5 Answers5

4

Check this one out!

pyinfo() A good looking phpinfo-like python script

2

There is nothing directly comparable to phpinfo(), but you can get some bits of information ...

>>> import sys
>>> sys.version
'2.6.4 (r264:75706, Feb  6 2010, 01:49:44) \n[GCC 4.2.1 (Apple Inc. build 5646)]'

>>> sys.platform
'darwin'

>>> sys.modules.keys()
['copy_reg', 'sre_compile', '_sre', 'encodings', 'site', ... ]

>>> import os
>>> os.name
'posix'

>>> import platform
>>> platform.architecture()
('32bit', '')

>>> platform.machine()
'i386'

...
miku
  • 172,072
  • 46
  • 300
  • 307
1

Afaik there is no similar function. However, the platform module allows you to access some basic information about the machine, OS and Python.

phihag
  • 263,143
  • 67
  • 432
  • 458
0

phpinfo prints information about running PHP version, loaded modules and so on.

AFAIK Python does not such a conventient function that dumps the complete configuration.

But you should have a look at the sys package.

import sys

# print all imported modules since start
print sys.modules

# print load path
print sys.path

...

Check out Python's sys-library reference.

Robert
  • 878
  • 6
  • 14