Skip to content

Instantly share code, notes, and snippets.

@studiawan
Last active March 11, 2021 04:57
Show Gist options
  • Save studiawan/6632475 to your computer and use it in GitHub Desktop.
Save studiawan/6632475 to your computer and use it in GitHub Desktop.
Python dictionary
# declare dictionary
banner = {}
# fill dictionary
banner['os'] = 'Ubuntu Server 13.04'
banner['server'] = 'ProFTPd 1.3.4'
banner['up'] = 315.5
banner[200] = 'OK'
print(banner)
# iterate through dictionary
for key, value in banner.items():
print(key, value)
# delete item based on key
del banner['up']
print(banner)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment