Open2
バックエンド学習日記
venvの仮想環境の入り方
myvenv/Scripts/activate
というコマンドを打ってもzsh: no such file or directory: myvenv/Scripts/activateと返却される。
どうやらmacではsource myvenv/bin/activate
と入力する必要があるらしい。
Dictionaries (dict)
-
Declaration
Standard Declarationd = {'key1':’value1', 'key2': 'value2'}
Using the
dict()
Function ①d = dict(key1="value1", key2="value2")
Using the
dict()
Function ②d = dict([('key1':’value1'), ('key1':’value1')])
-
Retrieving Values
Using [key]d['key']
Using the
get()
Methodd.get('key')
-
Updating Dictionaries
Using theupdate()
Methodd1 = {'a':10, 'b':20} d2 = {'a':1000, 'c': 30} d1.update(d2) print(d1) # {'a': 1000, 'b': 20, 'c': 30}