{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Dowloading a picture via urllib and python\n", "- python2 는 urllib 아래에 urlretrieve가 존재\n", "- python3은 urllib.requrest 아래에 urlretrieve가 존재" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2017-10-30T11:44:37.512465Z", "start_time": "2017-10-30T11:44:37.507106Z" } }, "outputs": [], "source": [ "import sys\n", "\n", "if sys.version_info[0] >= 3:\n", " from urllib.request import urlretrieve\n", "else:\n", " from urllib import urlretrieve\n", "\n", "\n", "urlretrieve(\"http://www-scf.usc.edu/~chiso/oldspice/m-b1-hello.jpg\")\n", "# jpg가 아닌 mp3 파일 등도 다운 가능" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" }, "latex_envs": { "LaTeX_envs_menu_present": true, "autocomplete": true, "bibliofile": "biblio.bib", "cite_by": "apalike", "current_citInitial": 1, "eqLabelWithNumbers": true, "eqNumInitial": 1, "hotkeys": { "equation": "Ctrl-E", "itemize": "Ctrl-I" }, "labels_anchors": false, "latex_user_defs": false, "report_style_numbering": false, "user_envs_cfg": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }