Horje
python switch case 3.10 Structural Pattern Matching Code Example
python switch case 3.10 Structural Pattern Matching
#From python 3.10 on, pattern matchin (switch case) has been added

def http_error(status):
    match status:
        case 400:
            return "Bad request"
        case 404:
            return "Not found"
        case 418:
            return "I'm a teapot"
        case 401|403|404:
          	return "Not allowed"
        case _:
            return "Something's wrong with the internet"

#Source: https://docs.python.org/3/whatsnew/3.10.html




Python

Related
python selenium firefox handle ssl bypass Code Example python selenium firefox handle ssl bypass Code Example
python nearly equal Code Example python nearly equal Code Example
read .fasta python Code Example read .fasta python Code Example
python round and map function Code Example python round and map function Code Example
contar ocorrĂȘncias letra string python Code Example contar ocorrĂȘncias letra string python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8