PyDocs

Nav

Python Runtime Services

getsource

inspect

function (source)
  • getsource(object)
Return the text of the source code for an object.

The argument may be a module, class, method, function, traceback, frame,
or code object.  The source code is returned as a single string.  An
OSError is raised if the source code cannot be retrieved.
Changed in 3.3
  • 3.3: OSError is raised instead of IOError, now an alias of the former.
0 Examples
No examples for inspect/getsource.
See Also
No see-alsos for inspect/getsource
0 Notes
No notes for getsource