Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はこの明らかに恐ろしいコードに出くわしました:
def determine_db_name(): if wallet_name in "": return "wallet.dat" else: return wallet_name
とはif xx in "":どういう意味ですか? 常に評価されるわけではありませんFalseか?
if xx in "":
False
通常in、キーが配列に存在するかどうか、または要素がリストに存在するかどうかを確認するときに使用されます。
in
>>> 2 in [1,2,3] True >>> 6 in [1,2,3] False >>> 'foo' in {'bar', 'foo', 'baz'} True
ただし、文字列に対しても機能します。
>>> 'foo' in 'barfoobar' True >>> 'foo' in 'barbarbar' False