2020
10-08
10-08
Python dict的常用方法示例代码
常用方法浅拷贝copya={"ilpy1":{"company":"aaa"},"ilpy2":{"company":"bbb"}}new_dict=a.copy()new_dict["ilpy1"]["company"]="wtf"print(new_dict)print(a)print(id(a))print(id(new_dict))print(id(new_dict["ilpy1"]["company"]))print(id(a["ilpy1"]["company"]))然后我们发现,执行这一步操作时new_dict["ilpy1"]["company"]="wtf",对a也执行了修改,比较id可知new_dict["ilpy1"]["company"]))和a["ilpy1...
继续阅读 >