Search notes:

Python: adding key-value pairs to a dictionary

This is an attempt to demonstrate how key-value pairs can be added to a dict:
#!/usr/bin/python3

#
#  Creating a dictionary
#
d = {'one'   : 1,
     'two'   : 2,
     'three' : 3}

#
#  Adding more items to the dictionary
#
d['four'] = 4
d['five'] = 5

for k,v in d.items():
    print(k, ' = ', v)
Github repository about-python, path: /types/dict/add.py

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758199276, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/types/dict/add(52): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78