Open2

バックエンド学習日記

kotouchablekotouchable

venvの仮想環境の入り方

myvenv/Scripts/activateというコマンドを打ってもzsh: no such file or directory: myvenv/Scripts/activateと返却される。

どうやらmacではsource myvenv/bin/activateと入力する必要があるらしい。

kotouchablekotouchable

Dictionaries (dict)

  1. Declaration
    Standard Declaration

    d = {'key1':’value1', 'key2': 'value2'}
    

    Using the dict()Function ①

    d = dict(key1="value1", key2="value2")
    

    Using the dict()Function ②

    d = dict([('key1':’value1'), ('key1':’value1')])
    
  2. Retrieving Values
    Using [key]

    d['key']
    

    Using the get()Method

    d.get('key')
    
  3. Updating Dictionaries
    Using the update()Method

    d1 = {'a':10, 'b':20}
    d2 = {'a':1000, 'c': 30}
    d1.update(d2)
    print(d1) # {'a': 1000, 'b': 20, 'c': 30}