【Python面試題】解釋一下Python中的成員運(yùn)算符?
【答案】:
通過(guò)成員運(yùn)算符‘in’和‘not in’,我們可以確認(rèn)一個(gè)值是否是另一個(gè)值的成員。
>>> 'me' in 'disappointment'
True
>>> 'us' not in 'disappointment'
True
通過(guò)成員運(yùn)算符‘in’和‘not in’,我們可以確認(rèn)一個(gè)值是否是另一個(gè)值的成員。
>>> 'me' in 'disappointment'
True
>>> 'us' not in 'disappointment'
True