Skip to content

Commit 9c76426

Browse files
committed
测试has_key
1 parent 2dab743 commit 9c76426

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

test/test_has_key.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
4+
"""
5+
@author: zhanghe
6+
@software: PyCharm
7+
@file: test_has_key.py
8+
@time: 2017/5/27 下午2:13
9+
"""
10+
11+
12+
a = {
13+
'foo': '1',
14+
'bar': '2',
15+
}
16+
17+
18+
def func():
19+
print a.has_key('foo') # deprecated
20+
print a.has_key('fob') # deprecated
21+
print 'foo' in a
22+
print 'fob' in a
23+
24+
25+
if __name__ == '__main__':
26+
func()

0 commit comments

Comments
 (0)