Last active
June 14, 2021 12:49
-
-
Save DivyanshByte/bd5ddcd3b44ac53c4385596a75e12c51 to your computer and use it in GitHub Desktop.
Colab File Downloader.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "Python File Dowloader.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"authorship_tag": "ABX9TyNtpLPWFj/bnWC/aQcjXz3r", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/DivyanshByte/bd5ddcd3b44ac53c4385596a75e12c51/python-file-dowloader.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "4jq7_wvDjHG2" | |
}, | |
"source": [ | |
"#Set the File URL" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "aRWAqKF_iUFV" | |
}, | |
"source": [ | |
"url = \"<put url here>\"\n", | |
"filename = \"<file name to save>\"" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "pJw85lWCiZq1" | |
}, | |
"source": [ | |
"#Downloading The File in Colab" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "7MG7YjAmjZ_7" | |
}, | |
"source": [ | |
"import os\n", | |
"import urllib.request\n", | |
"urllib.request.urlretrieve(url, filename)" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "2ymRNjVTivR7" | |
}, | |
"source": [ | |
"##See If The File is Downloaded" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "RlDa0Luhh94n" | |
}, | |
"source": [ | |
"import os\n", | |
"os.listdir('.')" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "JlkWl7AnimqI" | |
}, | |
"source": [ | |
"#Download the File to Your Local Computer" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "ebPPS3xKhody" | |
}, | |
"source": [ | |
"from google.colab import files\n", | |
"files.download('') " | |
], | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment