Python 字典 copy() 方法
实例
复制car字典:
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
x = car.copy()
print(x)
运行示例»
定义和用法
copy()方法返回指定字典的副本。
语法
dictionary.copy()
car字典:
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
x = car.copy()
print(x)
运行示例»
copy()方法返回指定字典的副本。