namedtuple.

编程入门 行业动态 更新时间:2024-10-09 02:21:56
本文介绍了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.

本文发布于:2023-11-25 11:52:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629632.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:namedtuple

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!