![](/img/trans.png)
[英]Python 3 how to get value from dictionary containing only one key-value pair with unknown key?
[英]Copy specifc key-value pair from one dictionary into another?
我正在嘗試從以下字典中獲取鍵值對
inventory = {0:["Boots",34],
1:["T-shirt",12],
2:["Jeans", 25],
3:["Socks", 4]
}
並將該特定鍵值對復制到一個空字典中
cart = {}
我怎么會go這個呢?
cart.append(inventory[i])
我是你正在嘗試的鍵值對索引 append。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.