python fromkeys() 创建字典

# d = dict.fromkeys("张无忌","赵敏") #创建字典
# print(d)#{'': '赵敏', '': '赵敏', '': '赵敏'}
# 返回新字典,和原来的字典没有关系
# dic = {}
# d = dic.fromkeys("风扇哥","很困")
# print(dic)# {}
# print(d)#{'': '很困', '': '很困', '': '很困'}

猜你喜欢

转载自www.cnblogs.com/sea-stream/p/10087416.html