ROOT
  • ROOT
  • Example file This is an example
  • duckdns
    • duckdns_not_working
  • general
    • i_have_an_error
  • hassbian
    • Get Hassbian
    • hassbian_config_install_multiple_suites
  • homeassistant
    • breaking_changes
    • confusing_ha_terms
    • Development setup (docker based)
    • Discord webhook
    • easy_le-ssl_duckdns_setup
    • reboot_after_config_change
    • trigger_stuff_with_curl
    • templates
      • get_all_entities_from_a_group
      • list_all_active_domains
      • share_state_between_two_devices
      • strings
      • translate_strftime_weekday
  • python
    • 99_bottles
    • append_to_dict_if_not_allready_there
  • raspberry
    • check_power_trottle
  • windows
    • startup-diskmapping
  • .github
    • PULL_REQUEST_TEMPLATE
      • New Hassbian-config function
    • PULL_REQUEST_TEMPLATE
      • New Suite
    • PULL_REQUEST_TEMPLATE
      • suite_fix_template
Powered by GitBook
On this page
  1. python

append_to_dict_if_not_allready_there

"""Append dict to dict."""
DICT = ['192.168.2.1', '192.168.2.2']
NEW_KEYS = ['192.168.1.1', '192.168.2.2', '192.168.1.3',
            '192.168.2.4', '192.168.1.5', '192.168.1.6']

for key in NEW_KEYS:
    if key not in DICT:
        print('adding' + key)
        DICT.append(key)
    else:
        print('skipping' + key)
print(DICT)
Previous99_bottlesNextraspberry

Last updated 6 years ago