最佳答案
假设我有一个类 C,它有属性 a。
从 Python 中的 C列表中获得 a之和的最佳方法是什么?
我试过以下代码,但我知道这不是正确的方法:
for c in c_list:
total += c.a