Some simple data is surprisingly hard to find. Case in point: for some mapping projects, I wanted an adjacency list of the US states. I couldn’t find one easily, so I made one. Spread it far and wide! This should be a pretty easy to digest form. Figure out what states are next to each other (neighbors) with ease!
- I say the four corners (UT,CO,NM,AZ) all touch. If you don’t like it, take them out.
- DC is a state here, but Guam, USVI and others aren’t.
- It’ll be a cold day in hell before I recognize Missouri.
# Author Gregg Lind # License: Public Domain. I would love to hear about any projects you use if it for though! AK AL,MS,TN,GA,FL AR,MO,TN,MS,LA,TX,OK AZ,CA,NV,UT,CO,NM CA,OR,NV,AZ CO,WY,NE,KS,OK,NM,AZ,UT CT,NY,MA,RI DC,MD,VA DE,MD,PA,NJ FL,AL,GA GA,FL,AL,TN,NC,SC HI IA,MN,WI,IL,MO,NE,SD ID,MT,WY,UT,NV,OR,WA IL,IN,KY,MO,IA,WI IN,MI,OH,KY,IL KS,NE,MO,OK,CO KY,IN,OH,WV,VA,TN,MO,IL LA,TX,AR,MS MA,RI,CT,NY,NH,VT MD,VA,WV,PA,DC,DE ME,NH MI,WI,IN,OH MN,WI,IA,SD,ND MO,IA,IL,KY,TN,AR,OK,KS,NE MS,LA,AR,TN,AL MT,ND,SD,WY,ID NC,VA,TN,GA,SC ND,MN,SD,MT NE,SD,IA,MO,KS,CO,WY NH,VT,ME,MA NJ,DE,PA,NY NM,AZ,UT,CO,OK,TX NV,ID,UT,AZ,CA,OR NY,NJ,PA,VT,MA,CT OH,PA,WV,KY,IN,MI OK,KS,MO,AR,TX,NM,CO OR,CA,NV,ID,WA PA,NY,NJ,DE,MD,WV,OH RI,CT,MA SC,GA,NC SD,ND,MN,IA,NE,WY,MT TN,KY,VA,NC,GA,AL,MS,AR,MO TX,NM,OK,AR,LA UT,ID,WY,CO,NM,AZ,NV VA,NC,TN,KY,WV,MD,DC VT,NY,NH,MA WA,ID,OR WI,MI,MN,IA,IL WV,OH,PA,MD,VA,KY WY,MT,SD,NE,CO,UT,ID
In some of our server code, we like to insure we get unbuffered output, like in perl. In Python, this is easy to do:
import sys sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
However, using the wonderful nosetest for testing will barf on this code, because it reassigns stdout to a cStringIO for capturing.
This is a workaround:
import sys import os try: # get unbuffered output sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) except AttributeError, exc: # under nose, sys.stdout is reassigned to a string buffer pass def test(): assert 1
Alternately, run nosetests -s, which disables the output capture feature.