耿直不好么
2018-09-08 01:58
为什么不能直接import collections
而是需要from collections import XXXXX
当然可以啊,直接导入py文件模块,或者Python包目录。
然后用```.```方法继续一层一层的访问到其中的Python模块或者类方法或者一般方法。
import collections User = collections.namedtuple("User", ['name', 'age', 'height']) user = User(name="mine", age=99, height=179) print('name:', user.name, "\n", 'age:', user.age, "\n", 'height:', user.height)
最后:你觉得使用起来方便吗?
python必学模块-collections
22305 学习 · 38 问题
相似问题