gpt4 book ai didi

python - 命名元组错误

转载 作者:行者123 更新时间:2023-11-28 21:58:10 25 4
gpt4 key购买 nike

<分区>

我正在尝试使用 namedtuple 将 Python 对象序列化为 JSON。但是我得到了这个错误。谷歌没有帮助。

Traceback (most recent call last):
File "cpu2.py", line 28, in <module>
cpuInfo = collections.namedtuple('cpuStats',('cpu.usr', ('str(currentTime) + " "
+str(cpuStats[0]) + " host="+ thisClient')), ('cpu.nice', ('str(currentTime) + " "
+str(cpuStats[1]) + " host="+ thisClient')), ('cpu.sys',('str(currentTime) + " "
+str(cpuStats[2]) + " host="+ thisClient')), ('cpu.idle',('str(currentTime) + " "
+str(cpuStats[3]) + " host="+ thisClient')))
TypeError: namedtuple() takes at most 4 arguments (5 given)

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com