keys()返回一个dict所有的key的list,values()返回一个dict所有value的list
import time
def log(*args, **kwargs):
# time.time() 返回 unix time
# 如何把 unix time 转换为普通人类可以看懂的格式呢?
format = '%Y/%m/%d %H:%M:%S'
value = time.localtime(int(time.time()))
dt = time.strftime(format, value)
print(dt, *args, **kwargs)
def test_2():
d = dict(name='user', passwd='123')
log(d)
log(d.keys())
log('name' in d.keys(), 'name1' in d.keys())
log(d.values())
log('user' in d.values(), '123' in d.values())
if __name__ == '__main__':
# test_1()
test_2()