namedtuple._source在python 3.7中不起作用 [英] namedtuple._source not working in python 3.7
本文介绍了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?
推荐答案
Yes, as stated here, the attribute _source
has been removed from namedtuples
in Python 3.7.
在3.7版中已更改:删除 verbose 参数和
_source
属性.
这篇关于namedtuple._source在python 3.7中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文