how can i effectively deal with this dirty multi-try code?

Use a loop to iterate the values

lst = ['sha1','sha224','sha256','sha384','sha512']
for s in lst:
    try:
        del response_json[s]
    except:
        print(f"keyError: Fail to delete {s} hash key")

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top