Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

match statement

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

PREVIOUS NEXT
Code Example
Python :: python negative indexing 
Python :: check is string is nan python 
Python :: how to delete an item from a list python 
Python :: turtle star python 
Python :: django apiview pagination 
Python :: python async partial function 
Python :: how to put legend outside pie plot in python 
Python :: python cli click 
Python :: python smtp sendmail 
Python :: python generate list 
Python :: iterate over dataframe 
Python :: set permissions role discord.py 
Python :: make legend box transparent in matplotlib 
Python :: python loop through dictionary 
Python :: python how to show package version 
Python :: pandas print dataframe without index 
Python :: numpy divide with exception 
Python :: torch flatten 
Python :: python pandas table save 
Python :: planets with python coding 
Python :: counter in python 
Python :: generate random integers python 
Python :: cors python 
Python :: python autocorrelation plot 
Python :: python module install a whl 
Python :: how to get a dictionary in alphabetical order python 
Python :: cli args python 
Python :: pandas df to dict 
Python :: rotating circular queue in python 
Python :: python int16 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =