Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A python list of all US state abbreviations.
states = [ 'AK', 'AL', 'AR', 'AZ', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'GA',
'HI', 'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA', 'MA', 'MD', 'ME',
'MI', 'MN', 'MO', 'MS', 'MT', 'NC', 'ND', 'NE', 'NH', 'NJ', 'NM',
'NV', 'NY', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX',
'UT', 'VA', 'VT', 'WA', 'WI', 'WV', 'WY']
states = {
'AK': 'Alaska',
'AL': 'Alabama',
'AR': 'Arkansas',
'AZ': 'Arizona',
'CA': 'California',
'CO': 'Colorado',
'CT': 'Connecticut',
'DC': 'District of Columbia',
'DE': 'Delaware',
'FL': 'Florida',
'GA': 'Georgia',
'HI': 'Hawaii',
'IA': 'Iowa',
'ID': 'Idaho',
'IL': 'Illinois',
'IN': 'Indiana',
'KS': 'Kansas',
'KY': 'Kentucky',
'LA': 'Louisiana',
'MA': 'Massachusetts',
'MD': 'Maryland',
'ME': 'Maine',
'MI': 'Michigan',
'MN': 'Minnesota',
'MO': 'Missouri',
'MS': 'Mississippi',
'MT': 'Montana',
'NC': 'North Carolina',
'ND': 'North Dakota',
'NE': 'Nebraska',
'NH': 'New Hampshire',
'NJ': 'New Jersey',
'NM': 'New Mexico',
'NV': 'Nevada',
'NY': 'New York',
'OH': 'Ohio',
'OK': 'Oklahoma',
'OR': 'Oregon',
'PA': 'Pennsylvania',
'RI': 'Rhode Island',
'SC': 'South Carolina',
'SD': 'South Dakota',
'TN': 'Tennessee',
'TX': 'Texas',
'UT': 'Utah',
'VA': 'Virginia',
'VT': 'Vermont',
'WA': 'Washington',
'WI': 'Wisconsin',
'WV': 'West Virginia',
'WY': 'Wyoming'
Copy link

jwblaney commented Jun 24, 2020

Thank you!

Copy link

mahdimq commented Jul 4, 2020

Thank you so much for this! Saved some time for me.

Copy link

JohnDeJesus22 commented Jul 22, 2020

Thank you for making this convenient for us!

Copy link

agastidukare commented Aug 25, 2020

God Bless You!

Copy link

dmcochener commented Aug 26, 2020

Just a note that in the post @gingercyde made, Delaware, Illinois, and Virginia have typos in them. Also, if you need it as a list of tuples (like for Flask or Django forms) here ya go:
STATES_TUPLE = [("AL","Alabama"),("AK","Alaska"),("AZ","Arizona"),("AR","Arkansas"),("CA", "California"),("CO", "Colorado"),
("CT","Connecticut"),("DC","Washington DC"),("DE","Delaware"),("FL","Florida"),("GA","Georgia"),
("MS","Mississippi"),("MO","Missouri"),("MT","Montana"),("NE","Nebraska"),("NV","Nevada"),("NH","New Hampshire"),
("NJ","New Jersey"),("NM","New Mexico"),("NY","New York"),("NC","North Carolina"),("ND","North Dakota"),("OH","Ohio"),
("OK","Oklahoma"),("OR","Oregon"),("PA","Pennsylvania"),("RI","Rhode Island"),("SC","South Carolina"),("SD","South Dakota"),
("TN","Tennessee"),("TX","Texas"),("UT","Utah"),("VT","Vermont"),("VA","Virginia"),("WA","Washington"),("WV","West Virginia"),

Copy link

nightduck commented Sep 19, 2020

Saving thousands of developers 2 minutes each

Copy link

abhijithumesh commented Nov 19, 2020


Copy link

Benzidrine commented Dec 4, 2020

Thank you

Copy link

StanShishmanov commented Dec 11, 2020

A great time-saver, thank you!

Copy link

NUCDUser commented Dec 30, 2020

Thank you so much!

Copy link

nicholasserra commented Mar 9, 2021


Copy link

reddy-madhukar commented Mar 13, 2021

thank you!

Copy link

nrd012 commented Mar 18, 2021

Thank you!

Copy link

sschet commented Mar 24, 2021

Thank you!

Copy link

hackerman123456789 commented Mar 25, 2021

Thanks! using for a discord bot that gives covid19 info.

Copy link

mikeemorales commented Apr 5, 2021

Here's by region:

west = ["CA", "OR", "WA", "NV", "ID", "UT", "CO", "WY", "MT"]
midwest = ["ND", "SD", "NE", "KS", "MN", "IA", "MO", "WI", "IL", "IN", "MI", "OH"]
southwest = ["AZ", "NM", "TX", "OK"]
southeast = ["AR", "LA", "MS", "TN", "AL", "KY", "GA", "WV", "VA", "NC", "SC", "FL", "MD", "DE"]
northeast = ["CT", "DC", "HI", "ME", "MA", "NH", "NJ", "NY", "PA", "RI", "VT"]
noncontig = ["HI", "AK"]

Copy link

Wsanders81 commented May 18, 2021

Sweet! Thank you!

Copy link

ramizarif commented May 18, 2021

Youre the goat

Copy link

tornikeo commented Jun 8, 2021


Copy link

zcardwell commented Jul 27, 2021

Thank you!

Copy link

bsvo commented Aug 4, 2021


Copy link

quintonsteele commented Aug 18, 2021

thanks dude

Copy link

YangWu1227 commented Oct 19, 2021

Peace and Love, Brodie!

Copy link

Sdeimen commented Oct 25, 2021


Copy link

WrenPriest commented Jan 21, 2022

Thank you so much!

Copy link

chrisbabayans commented Jan 29, 2022

Thank you so very much!

Copy link

michellemason commented Jan 30, 2022

thank you, you are awesome!

Copy link

eagleoflqj commented Feb 23, 2022

Thank you!

Copy link

sunnydaisy commented Feb 27, 2022

Thank you

Copy link

NozNozNozNoz commented Apr 28, 2022

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment