how to import a.py not a folder
Posted
by zjm1126
on Stack Overflow
See other posts from Stack Overflow
or by zjm1126
Published on 2010-05-14T08:49:54Z
Indexed on
2010/05/14
8:54 UTC
Read the original article
Hit count: 301
zjm_code
|-----a.py
|-----a
|----- __init__.py
|-----b.py
in a.py is :
c='ccc'
in b.py is :
import a
print dir(a)
when i execute b.py ,it show (it import 'a' folder):
['__builtins__', '__doc__', '__file__', '__name__', '__path__']
and when i delete a folder, it show ,(it import a.py):
['__builtins__', '__doc__', '__file__', '__name__', 'c']
so my question is :
how to import a.py via not delete a folder
thanks
© Stack Overflow or respective owner