ImportError: cannot import name 'city_co'自闭了求大佬指点
python3吧
全部回复
仅看楼主
level 2
百度了,没解决
2020年08月27日 09点08分 1
level 8
把city_functions.py重命名为__init__.py
city_functions是一个包, python导入包时首先会导入__init__.py中的函数
2020年08月28日 02点08分 3
或者在__init__.py中加入代码: from city_functions.city_functions import city_co
2020年08月28日 02点08分
@tbiy_7330 还是不对[泪] 请问能不能推荐一下讲模块这部分的书或网站,我看的从入门到实践,模块部分没怎么讲
2020年08月28日 12点08分
@tbiy_7330 File "<pyshell#1>", line 1, in <module> from city_functions import city_co File "C:\Users\eway\AppData\Local\Programs\Python\Python36\lib\site-packages\city_functions\__init__.py", line 1
2020年08月28日 12点08分
@楠枫一Queen 书是《Python基础教程 第3版》 网站是python的官方文档 https://docs.python.org/zh-cn/
2020年08月28日 12点08分
level 2
按3楼做,然后把def前面的》》》和之前的所有行都删掉
2020年10月25日 12点10分 5
1