0

'=' not in access and name + '.' not in access

我希望not in access在一行 Python 代码中避免 s 的多重性。为了方便起见,我在重复次数较多的情况下使用了表达式求值循环,但它在两次时似乎很奇怪。

4

1 回答 1

0

这是另一种选择:

all(s not in access for s in ('=', name + '.'))

由您决定这是否比您的代码更简单 - 但至少它避免了编写not in access 两次

于 2016-08-04T03:55:43.060 回答