De-compiler for *.pyc files

Michael Hudson mwh21 at
Sat Mar 11 17:28:35 CET 2000

"Zarkon & Zena" <nospam at> writes:

> Ok, I have played with "dis" module a little bit, but don't I need to know
> the names of the functions inside the *.pyc file before I can get at them?

Oh that's easy:

Python 1.5.2+ (#13, Jan 14 2000, 09:26:45) 
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import string
>>> dir(string)
['_StringType', '__builtins__', '__doc__', '__file__', '__name__',
'_apply', '_float', '_idmap', '_idmapL', '_int', '_long', 'atof',
'atof_error', 'atoi', 'atoi_error', 'atol', 'atol_error',
'capitalize', 'capwords', 'center', ...


def getfuncs(module):
    r = []
    for f in module.__dict__.values():
        if type(f) is type(getfuncs):
           r.append( f )
    return f

or something like that.

I suggest a close reading of the langauge reference if you intend to
poke around on this level.


very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp

More information about the Python-list mailing list