On 05/19/2010 09:40 AM, Harikrishnan R wrote:
Hi ,
     I have a file a.py contains

     from one.two import abc
--------------------------------------------
     is there any way to find out  "one.two" the import Path of abc. ?
I don't want one.two.abc . Any function or attribute which directly
give one.two ?

-Regards


What's so hard about computing what you want from what your can get.

Since abc.__module__ gives gives you too much, trim it down -- perhaps even with os.path.splitext, although that's not what what splitext was meant for.

    os.path.splitext(abc.__module__)[0]


Gary Herron

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to