Skip to content

Instantly share code, notes, and snippets.

@Hultner
Last active March 11, 2021 20:53
Pattern matching HTTP Status codes
status_code = 200
match status_code:
case 404: print("Not found")
case 200: print("Ok")
case _: raise ValueError("Can't handle status code")
# Prints "Ok"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment