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

busterroni commented Apr 9, 2016

Thanks for this, saved me some time :)

@ghost

This comment has been minimized.

Copy link

ghost 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

gyurisc commented Jul 14, 2016

Thanks. It saved me time :)

@charleycodes

This comment has been minimized.

Copy link

charleycodes 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

EduGord 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

timle commented Feb 24, 2017

Thanks!

@rpaguirre

This comment has been minimized.

Copy link

rpaguirre commented Apr 1, 2017

You're the man!

@pganeshGapps

This comment has been minimized.

Copy link

pganeshGapps commented May 30, 2017

Thanks man, saved my time :)!

@colbych

This comment has been minimized.

Copy link

colbych commented Jul 11, 2017

Thank you!

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 4, 2017

Thanks 👍

@maxu777

This comment has been minimized.

Copy link

maxu777 commented Oct 8, 2017

Thank you - that helps!

@wnykuang

This comment has been minimized.

Copy link

wnykuang commented Nov 6, 2017

Thanks, very helpful!

@sasms

This comment has been minimized.

Copy link

sasms commented Nov 13, 2017

Amazing!

@Miando

This comment has been minimized.

Copy link

Miando commented Dec 2, 2017

Cool. Thank you!

@ChuckZhu

This comment has been minimized.

Copy link

ChuckZhu commented Dec 20, 2017

Thanks

@nikevp

This comment has been minimized.

Copy link

nikevp commented Jan 4, 2018

Gracias

@maxmadubuike

This comment has been minimized.

Copy link

maxmadubuike commented Jan 6, 2018

Thank you for this! Saved me some time.

@RonKG

This comment has been minimized.

Copy link

RonKG commented Apr 6, 2018

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

@LisaFan18

This comment has been minimized.

Copy link

LisaFan18 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

majacaci00 commented Jun 7, 2018

Thank you!!!

@hoaphamutsa

This comment has been minimized.

Copy link

hoaphamutsa commented Jun 21, 2018

thank you

@BobBurrows

This comment has been minimized.

Copy link

BobBurrows commented Jun 27, 2018

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

@guitarist600

This comment has been minimized.

Copy link

guitarist600 commented Jun 27, 2018

Thank you!

@ezeagwulae

This comment has been minimized.

Copy link

ezeagwulae commented Sep 20, 2018

very helpful. thanks.

@bfine9618

This comment has been minimized.

Copy link

bfine9618 commented Oct 3, 2018

awesome!

@ethanzh

This comment has been minimized.

Copy link

ethanzh commented Nov 15, 2018

Thanks!

@jsheedy

This comment has been minimized.

Copy link

jsheedy 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

ewmendez commented Jan 3, 2019

Thanks!

@summonholmes

This comment has been minimized.

Copy link

summonholmes commented Jan 22, 2019

Thanks, I love being a lazy programmer.

@Aidan-Jared

This comment has been minimized.

Copy link

Aidan-Jared commented Mar 8, 2019

the most beautiful thing if you are lazy

@gingercyde

This comment has been minimized.

Copy link

gingercyde 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

tudorschlanger commented Apr 13, 2019

Thank you kindly!

@mattymecks

This comment has been minimized.

Copy link

mattymecks commented May 8, 2019

Much appreciated!

@tlancon

This comment has been minimized.

Copy link

tlancon 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

SHi-ON 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.