The code data.update({web_isbn: web_isbn}) uses the value of the variable web_isbn as the key, not the string "web_isbn". For example, if web_isbn is "9781234567890", then data will have an entry { "9781234567890": "9781234567890" }. Later, data.get(f"{web_isbn}", f"{isbn}") tries to retrieve the value for the key equal to the value of web_isbn (i.e., the actual ISBN parsed from the web). If that key does not exist, it falls back to the value of isbn. This logic ensures that the code prioritizes using the ISBN obtained from the web, and only uses the original isbn if the web-parsed one is unavailable. If you want to use a fixed key, you should write data.update({"web_isbn": web_isbn}), but the current code intentionally uses a dynamic key to distinguish between different sources of ISBN information. Reference