(参考) 以下おすすめです。たいへんわかりやすいです。
lookup関数
dic = {'apple':' りんご','orange':' みかん','lemon':' レモン'}
dicOut=dic['apple']
print('-----------------------------------------------------')
print(type('apple'),'apple')
print(type(dic) ,dic)
print(type(dicOut),dicOut)
#<class 'str'> apple
#<class 'dict'> {'apple': ' りんご', 'orange': ' みかん', 'lemon': ' レモン'}
#<class 'str'> りんご
sum関数
dic = {'apple':50,'orange':60,'lemon': 70}
list = dic.values()
gokei= sum(list)
print('-----------------------------------------------------')
print(type(list),list)
print(type(gokei),gokei)
#<class 'dict_values'> dict_values([50, 60, 70])
#<class 'int'> 180
(参考)
sumif関数
調査中
セルに名前を定義する(Nameプロパティ)
リスト1とリスト2から辞書型を作成
def list2dic(lst1,lst2):
n=len(lst1)
i=0
dict={}
while i<n:
dict[lst1[i]]=lst2[i]
i += 1
else:
return dict
lst1= ['apple' ,'orange', 'lemon']
lst2= ['りんご', 'みかん', 'レモン']
lst12=list2dic(lst1,lst2)
print(type(lst12),lst12)
#<class 'dict'> {'apple': 'りんご', 'orange': 'みかん', 'lemon': 'レモン'}
特定のセルまたはセル範囲を選択する
(参考)組み込みの dict 型に対する変更どうしても値のリストが必要な場合には、返された dict オブジェクトをキャストする
myDict = {'apple':50,'orange':60,'lemon': 70}
myList = myDict.values()
myCast = list(myList)
myGokei= sum(myList)
print('-----------------------------------------------------')
print(type(myList),myList)
print(type(myCast),myCast)
print(type(myGokei),myGokei)
# <class 'dict_values'> dict_values([50, 60, 70])
# <class 'list'> [50, 60, 70]
# <class 'int'> 180