/tmp# mkdir foobar
/tmp# python3
Python 3.4.3 (default, Nov 28 2017, 16:41:13)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import foobar
>>>
Run Code Online (Sandbox Code Playgroud)
为什么python允许导入任何随机(包括空)目录?那么,在上面的快照中,我是导入包还是模块?是的,“foobar”是一个文件夹,但导入目标始终是一个模块(.py 文件),不是吗?
| 归档时间: |
|
| 查看次数: |
731 次 |
| 最近记录: |