Get path of a class

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Jan 10 21:22:10 EST 2006


In <1136728498.104759.153600 at g43g2000cwa.googlegroups.com>, Florian
Lindner wrote:

> Hello,
> how can I get the path of a class. I managed to do it with
> 
> c.__module__ + "." + c.__name__
> 
> but I'm sure there is a better way.

How about using the `inspect` module::

 In [33]: import inspect, zipfile

 In [34]: inspect.getsourcefile(zipfile.ZipInfo)
 Out[34]: '/usr/lib/python2.4/zipfile.py'

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list