Python Dictionary contains List as Value - How to update?

前端 未结 6 1504
甜味超标
甜味超标 2020-12-24 06:02

I have a dictionary which has value as a list.

dictionary = { 
               \'C1\' : [10,20,30] 
               \'C2\' : [20,30,40]
             }
<         


        
6条回答
  •  不思量自难忘°
    2020-12-24 06:19

    why not just skip .get altogether and do something like this?:

    for x in range(len(dictionary["C1"]))
        dictionary["C1"][x] += 10
    

提交回复
热议问题