There was an error while loading. Please reload this page.
2 parents e01d423 + 8788f0a commit 97954d7Copy full SHA for 97954d7
python_base.py
@@ -763,8 +763,8 @@ def add(x,y):return x + y
763
"""
764
765
#-- 包相对导入:使用点号(.) 只能使用from语句
766
- from . import spam # 导入当前目录下的spam模块(错误: 当前目录下的模块, 直接导入即可)
767
- from .spam import name # 导入当前目录下的spam模块的name属性(错误: 当前目录下的模块, 直接导入即可,不用加.)
+ from . import spam # 导入当前目录下的spam模块(Python2: 当前目录下的模块, 直接导入即可)
+ from .spam import name # 导入当前目录下的spam模块的name属性(Python2: 当前目录下的模块, 直接导入即可,不用加.)
768
from .. import spam # 导入当前目录的父目录下的spam模块
769
770
#-- 包相对导入与普通导入的区别
0 commit comments