我是否总是必须要返回一个函数?

时间:2019-06-04 10:34:06

标签: python return boolean

是否必须放置from parsel import Selector selector = Selector(json_value['html']) desired_text = selector.css('span.car_model_estimation_result_amount').get() ,以便如果未完成循环,则返回True?

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11
not samsung 4
not android 4.4.3-4.4.4
not last 2 ie_mob versions
not last 2 op_mini versions
not last 2 op_mob versions
not last 2 baidu versions
not last 2 kaios versions
not last 2 and_uc versions
not last 2 and_qq versions
not last 2 edge versions
not chrome 49

是否总是需要退货?如果我放一个return True会更好吗?

def isCompletable(self):
    for x, row in enumerate(self.board):
        for y, dot in enumerate(row):
            if dot.value != None:
                if dot.value < self.bluesift(x, y):
                    return False
                if dot.value > self.bluesiftg(x, y) + self.greysift(x, y):
                    return False
    return True

0 个答案:

没有答案