Skip to content

Instantly share code, notes, and snippets.

View grigoryk's full-sized avatar

Grisha Kruglov grigoryk

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# read our input file into the list
with open("NAICS.txt", "r") as f:
lines = list(f)
# go through every line and clear it up
sanitized = map(lambda l: l.replace("\r", "").replace("\n", ""), lines)
# "zip" the list into touples, in groups of two
# produces a list such as [('1234', 'SOME NAME'), ...]
zipped = zip(*[iter(sanitized)]*2)