How to list all functions in an imported module?
Peter Abel
PeterAbel at gmx.net
Thu May 27 15:38:37 EDT 2004
klachemin at home.com (Kamilche) wrote in message news:<889cbba0.0405270506.3cd91d26 at posting.google.com>...
> I can't figure out how to list all functions from an imported module.
> I searched Google, but all the answers I found didn't work. Did
> something change in Python 2.2, perhaps there's a new method of doing
> it?
e.g the module os
>>> import os,types
>>> for k,v in os.__dict__.items():
... if type(v) == types.BuiltinFunctionType or\
... type(v) == types.BuiltinMethodType or\
... type(v) == types.FunctionType or\
... type(v) == types.MethodType:
... print '%-20s: %r' % (k,type(v))
...
rename : <type 'builtin_function_or_method'
lseek : <type 'builtin_function_or_method'>
_get_exports_list : <type 'function'>
execle : <type 'function'>
chmod : <type 'builtin_function_or_method'>
execlp : <type 'function'>
open : <type 'builtin_function_or_method'>
write : <type 'builtin_function_or_method'>
putenv : <type 'builtin_function_or_method'>
fdopen : <type 'builtin_function_or_method'>
_pickle_statvfs_result: <type 'function'>
startfile : <type 'builtin_function_or_method'>
umask : <type 'builtin_function_or_method'>
system : <type 'builtin_function_or_method'>
_execvpe : <type 'function'>
getpid : <type 'builtin_function_or_method'>
tmpnam : <type 'builtin_function_or_method'>
dup : <type 'builtin_function_or_method'>
spawnve : <type 'builtin_function_or_method'>
getenv : <type 'function'>
isatty : <type 'builtin_function_or_method'>
execvpe : <type 'function'>
dup2 : <type 'builtin_function_or_method'>
read : <type 'builtin_function_or_method'>
execvp : <type 'function'>
popen3 : <type 'builtin_function_or_method'>
_make_stat_result : <type 'function'>
execve : <type 'builtin_function_or_method'>
utime : <type 'builtin_function_or_method'>
execl : <type 'function'>
chdir : <type 'builtin_function_or_method'>
renames : <type 'function'>
strerror : <type 'builtin_function_or_method'>
remove : <type 'builtin_function_or_method'>
fstat : <type 'builtin_function_or_method'>
execv : <type 'builtin_function_or_method'>
execlpe : <type 'function'>
tempnam : <type 'builtin_function_or_method'>
tmpfile : <type 'builtin_function_or_method'>
popen4 : <type 'builtin_function_or_method'>
popen2 : <type 'builtin_function_or_method'>
stat : <type 'builtin_function_or_method'>
abort : <type 'builtin_function_or_method'>
close : <type 'builtin_function_or_method'>
_exists : <type 'function'>
spawnl : <type 'function'>
makedirs : <type 'function'>
access : <type 'builtin_function_or_method'>
unsetenv : <type 'function'>
mkdir : <type 'builtin_function_or_method'>
spawnv : <type 'builtin_function_or_method'>
listdir : <type 'builtin_function_or_method'>
_pickle_stat_result : <type 'function'>
lstat : <type 'builtin_function_or_method'>
spawnle : <type 'function'>
getcwd : <type 'builtin_function_or_method'>
unlink : <type 'builtin_function_or_method'>
_make_statvfs_result: <type 'function'>
popen : <type 'builtin_function_or_method'>
times : <type 'builtin_function_or_method'>
pipe : <type 'builtin_function_or_method'>
removedirs : <type 'function'>
_exit : <type 'builtin_function_or_method'>
rmdir : <type 'builtin_function_or_method'>
>>>
Regards
Peter
More information about the Python-list
mailing list