When is a module imported from the standard library?

Ignacio Vazquez-Abrams ignacio at openservices.net
Wed Aug 22 16:09:53 EDT 2001


On Wed, 22 Aug 2001, cary miller wrote:

> How about this?
>
> import os
> mod = eval('os')
> mod.__file__

That works, although we don't need the eval() in there, I think.

---
#! /usr/bin/python

import os

print os.path.dirname(os.__file__)
---

There we go. I think that's the simplest possible implementation. Does
everyone agree?

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>





More information about the Python-list mailing list