本文介绍了namedtuple._source在python 3.7中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经尝试过使用此代码
I've tried with this code
from collections import namedtuple t = namedtuple('t', 'a b c') i = t(1,2,3) print(i._source, t._source)但是当我运行它时,它说没有属性 _source (对于 t ,因此对于 i ).自3.6以来已被淘汰吗?
But when I run it it says that there is no attribute _source (for t and therefore also for i). Has it been eliminated since 3.6?
推荐答案是的,如在此,属性 _source 已从Python 3.7中的 namedtuples 中删除./p>
Yes, as stated here, the attribute _source has been removed from namedtuples in Python 3.7.
在3.7版中已更改:删除 verbose 参数和 _source 属性.
更多推荐
namedtuple.
发布评论