Skip to content

Instantly share code, notes, and snippets.

Embed
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'
}
@jwblaney
Copy link

jwblaney commented Jun 24, 2020

Thank you!

@mahdimq
Copy link

mahdimq commented Jul 4, 2020

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

@JohnDeJesus22
Copy link

JohnDeJesus22 commented Jul 22, 2020

Thank you for making this convenient for us!

@agastidukare
Copy link

agastidukare commented Aug 25, 2020

God Bless You!

@dmcochener
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"),
("HI","Hawaii"),("ID","Idaho"),("IL","Illinois"),("IN","Indiana"),("IA","Iowa"),("KS","Kansas"),("KY","Kentucky"),
("LA","Louisiana"),("ME","Maine"),("MD","Maryland"),("MA","Massachusetts"),("MI","Michigan"),("MN","Minnesota"),
("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"),
("WI","Wisconsin"),("WY","Wyoming")]

@nightduck
Copy link

nightduck commented Sep 19, 2020

Saving thousands of developers 2 minutes each

@abhijithumesh
Copy link

abhijithumesh commented Nov 19, 2020

thanks

@Benzidrine
Copy link

Benzidrine commented Dec 4, 2020

Thank you

@StanShishmanov
Copy link

StanShishmanov commented Dec 11, 2020

A great time-saver, thank you!

@NUCDUser
Copy link

NUCDUser commented Dec 30, 2020

Thank you so much!

@nicholasserra
Copy link

nicholasserra commented Mar 9, 2021

Thanks!

@reddy-madhukar
Copy link

reddy-madhukar commented Mar 13, 2021

thank you!

@nrd012
Copy link

nrd012 commented Mar 18, 2021

Thank you!

@sschet
Copy link

sschet commented Mar 24, 2021

Thank you!

@hackerman123456789
Copy link

hackerman123456789 commented Mar 25, 2021

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

@mikeemorales
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"]

@Wsanders81
Copy link

Wsanders81 commented May 18, 2021

Sweet! Thank you!

@ramizarif
Copy link

ramizarif commented May 18, 2021

Youre the goat

@tornikeo
Copy link

tornikeo commented Jun 8, 2021

Lifesaver.

@zcardwell
Copy link

zcardwell commented Jul 27, 2021

Thank you!

@bsvo
Copy link

bsvo commented Aug 4, 2021

thanks

@quintonsteele
Copy link

quintonsteele commented Aug 18, 2021

thanks dude

@YangWu1227
Copy link

YangWu1227 commented Oct 19, 2021

Peace and Love, Brodie!

@Sdeimen
Copy link

Sdeimen commented Oct 25, 2021

Thanks!

@WrenPriest
Copy link

WrenPriest commented Jan 21, 2022

Thank you so much!

@chrisbabayans
Copy link

chrisbabayans commented Jan 29, 2022

Thank you so very much!

@michellemason
Copy link

michellemason commented Jan 30, 2022

thank you, you are awesome!

@eagleoflqj
Copy link

eagleoflqj commented Feb 23, 2022

Thank you!

@sunnydaisy
Copy link

sunnydaisy commented Feb 27, 2022

Thank you

@NozNozNozNoz
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