Skip to content

Instantly share code, notes, and snippets.

@yzguy
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save yzguy/0dfcd6ad7be591df24f3 to your computer and use it in GitHub Desktop.

Select an option

Save yzguy/0dfcd6ad7be591df24f3 to your computer and use it in GitHub Desktop.
From this:
----------
csv_file = csv.DictReader(open(sys.argv[2], 'r'))
To This:
--------
with open(sys.argv[2], 'r') as csv_file:
csv_data = csv.DictReader(csv_file)
for row in csv_data:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment