小编lit*_*ion的帖子

在嵌套字典中添加项目

我正在自学 Python,并且正在尝试用 Python 创建一个订购应用程序。该程序将用户给定的产品编号及其价格添加到新字典中。

但是我想不出将这些物品的价格加在一起的方法。

alijst = {}
kera = {1001 : {"naam" : '60 X 60 Lokeren', 'prijs' : 31.95},#the third item (31.95) is the prize and needs to be used in a calculation later
          1002 : {"naam" : '40 X 80 Houtlook' , 'prijs' : 32.5},
          1003 : {"naam" : '60 X 60 Beïge', 'prijs' :  29.95}}

# The below is for finding the code linked to a product
def keramisch():
    global kera
    global alijst
    klaar = False …
Run Code Online (Sandbox Code Playgroud)

python nested

-4
推荐指数
1
解决办法
209
查看次数

标签 统计

nested ×1

python ×1