Skip to content

Commit

Permalink
Remove try/finally block from code used to write csv
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Tse authored and Scott Tse committed Feb 14, 2017
1 parent 21698ac commit 10816fe
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions US_federal_holidays.ipynb
Expand Up @@ -129,15 +129,12 @@
"# writes a new csv file with holidays recognized in OR using the holidays module\n",
"\n",
"with open('or_holidays.csv', 'w', newline='') as f:\n",
" try:\n",
" writer = csv.writer(f)\n",
" writer.writerow(['date', 'holiday'])\n",
" for date, name in sorted(holidays.US(state='OR', years=[2010, 2011, 2012, 2013, 2014, 2015, 2016]).items()):\n",
" print(date, name)\n",
" writer.writerow([date, name])\n",
" finally:\n",
" f.close()\n",
" "
" writer = csv.writer(f)\n",
" writer.writerow(['date', 'holiday'])\n",
" for date, name in sorted(holidays.US(state='OR', years=[2010, 2011, 2012, 2013, 2014, 2015, 2016]).items()):\n",
" print(date, name)\n",
" writer.writerow([date, name])\n",
" "
]
},
{
Expand Down

0 comments on commit 10816fe

Please sign in to comment.