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 = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA",
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
"MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
"SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"]
@busterroni

This comment has been minimized.

Copy link

commented Apr 9, 2016

Thanks for this, saved me some time :)

@ghost

This comment has been minimized.

Copy link

commented May 28, 2016

Thank you, I'm working on address standardization for Amazon order data, and they don't do any kind of validation. This is most helpful.

@gyurisc

This comment has been minimized.

Copy link

commented Jul 14, 2016

Thanks. It saved me time :)

@charleycodes

This comment has been minimized.

Copy link

commented Nov 17, 2016

Used this as a global variable to iterate over for PostgreSQL queries. Thank you!

@EduGord

This comment has been minimized.

Copy link

commented Jan 29, 2017

Thanks for sharing! I have used it to complete an exercise while studying pandas.

@timle

This comment has been minimized.

Copy link

commented Feb 24, 2017

Thanks!

@rpaguirre

This comment has been minimized.

Copy link

commented Apr 1, 2017

You're the man!

@pganeshGapps

This comment has been minimized.

Copy link

commented May 30, 2017

Thanks man, saved my time :)!

@colbych

This comment has been minimized.

Copy link

commented Jul 11, 2017

Thank you!

@ghost

This comment has been minimized.

Copy link

commented Aug 4, 2017

Thanks 👍

@maxu777

This comment has been minimized.

Copy link

commented Oct 8, 2017

Thank you - that helps!

@wnykuang

This comment has been minimized.

Copy link

commented Nov 6, 2017

Thanks, very helpful!

@sasms

This comment has been minimized.

Copy link

commented Nov 13, 2017

Amazing!

@Miando

This comment has been minimized.

Copy link

commented Dec 2, 2017

Cool. Thank you!

@ChuckZhu

This comment has been minimized.

Copy link

commented Dec 20, 2017

Thanks

@nikevp

This comment has been minimized.

Copy link

commented Jan 4, 2018

Gracias

@maxmadubuike

This comment has been minimized.

Copy link

commented Jan 6, 2018

Thank you for this! Saved me some time.

@RonKG

This comment has been minimized.

Copy link

commented Apr 6, 2018

Thank you! This is very handy. First thing that showed on Google 💯

@LisaFan18

This comment has been minimized.

Copy link

commented Apr 21, 2018

Thanks. I am doing my homework about shiny in R. I need a U.S. state abbreviations for selectInput choices.

@majacaci00

This comment has been minimized.

Copy link

commented Jun 7, 2018

Thank you!!!

@hoaphamutsa

This comment has been minimized.

Copy link

commented Jun 21, 2018

thank you

@BobBurrows

This comment has been minimized.

Copy link

commented Jun 27, 2018

This saved Dan and I lot's time - thanks you thank you!

@guitarist600

This comment has been minimized.

Copy link

commented Jun 27, 2018

Thank you!

@ezeagwulae

This comment has been minimized.

Copy link

commented Sep 20, 2018

very helpful. thanks.

@bfine9618

This comment has been minimized.

Copy link

commented Oct 3, 2018

awesome!

@ethanzh

This comment has been minimized.

Copy link

commented Nov 15, 2018

Thanks!

@jsheedy

This comment has been minimized.

Copy link

commented Nov 19, 2018

Thank you!

Here it is in lowercase, which I needed:

print([state.lower() for state in states])
['al', 'ak', 'az', 'ar', 'ca', 'co', 'ct', 'dc', 'de', 'fl', 'ga', 'hi', 'id', 'il', 'in', 'ia', 'ks', 'ky', 'la', 'me', 'md', 'ma', 'mi', 'mn', 'ms', 'mo', 'mt', 'ne', 'nv', 'nh', 'nj', 'nm', 'ny', 'nc', 'nd', 'oh', 'ok', 'or', 'pa', 'ri', 'sc', 'sd', 'tn', 'tx', 'ut', 'vt', 'va', 'wa', 'wv', 'wi', 'wy']
@ewmendez

This comment has been minimized.

Copy link

commented Jan 3, 2019

Thanks!

@summonholmes

This comment has been minimized.

Copy link

commented Jan 22, 2019

Thanks, I love being a lazy programmer.

@Aidan-Jared

This comment has been minimized.

Copy link

commented Mar 8, 2019

the most beautiful thing if you are lazy

@gingercyde

This comment has been minimized.

Copy link

commented Apr 9, 2019

Here is one with the abbreviations and state names!

states = ["AL - Alabama", "AK - Alaska", "AZ - Arizona", "AR - Arkansas", "CA - California", "CO - Colorado",
"CT - Connecticut", "DC - Washington DC", "DE - Deleware", "FL - Florida", "GA - Georgia",
"HI - Hawaii", "ID - Idaho", "IL - Illinios", "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 - Virgina", "WA - Washington", "WV - West Virginia",
"WI - Wisconsin", "WY - Wyoming"]

@tudorschlanger

This comment has been minimized.

Copy link

commented Apr 13, 2019

Thank you kindly!

@mattymecks

This comment has been minimized.

Copy link

commented May 8, 2019

Much appreciated!

@tlancon

This comment has been minimized.

Copy link

commented May 15, 2019

Thanks, huge help! Here is a dictionary with abbreviations as well: https://gist.github.com/tlancon/9794920a0c3a9990279de704f936050c

@SHi-ON

This comment has been minimized.

Copy link

commented May 21, 2019

Tnx, saved time!
Alphabetically sorted, as well:
https://gist.github.com/SHi-ON/ffbaf1d709aa5f49dbfa177a3203ad18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.