[英]Python yield generator function
So I've got this ginormous humungous class, of which the only relevant code is: 因此,我得到了这个庞大的类,其中唯一相关的代码是:
def get_col_is_numeric(self, col_name):
"Returns an iterator with each cell length in the named column"
min(self.get_col_iter_is_numeric(col_name))
... and I loaded some values into the dict from a csv file. ...,然后从csv文件将一些值加载到dict中。
Problem is that csvDictReaderCol.get_col_is_numeric('Ann_payrll') returns None even though all values in the column are numbers. 问题是,即使列中的所有值都是数字,csvDictReaderCol.get_col_is_numeric('Ann_payrll')也会返回“无”。 Why does yield generate a None value? 为什么yield会产生None值?
get_col_is_numeric is missing a return statement so it returns None. get_col_is_numeric缺少返回语句,因此它返回None。
Also next time, try just posting the actual functions/methods involved rather then the whole class. 同样在下一次,请尝试仅发布所涉及的实际功能/方法,而不是整个类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.