Skip to content

Commit

Permalink
In Python 3, we can use os.makedirs(..., exist_ok=True)
Browse files Browse the repository at this point in the history
  • Loading branch information
ageron committed Aug 27, 2019
1 parent e8f86ce commit 3c896e1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions 02_end_to_end_machine_learning_project.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@
"HOUSING_URL = DOWNLOAD_ROOT + \"datasets/housing/housing.tgz\"\n",
"\n",
"def fetch_housing_data(housing_url=HOUSING_URL, housing_path=HOUSING_PATH):\n",
" if not os.path.isdir(housing_path):\n",
" os.makedirs(housing_path)\n",
" os.makedirs(housing_path, exist_ok=True)\n",
" tgz_path = os.path.join(housing_path, \"housing.tgz\")\n",
" urllib.request.urlretrieve(housing_url, tgz_path)\n",
" housing_tgz = tarfile.open(tgz_path)\n",
Expand Down

0 comments on commit 3c896e1

Please sign in to comment.