From c72e3cc684a8db55e9b86a33e070fc3340093f59 Mon Sep 17 00:00:00 2001 From: HarimJ <58238503+HarimJ@users.noreply.github.com> Date: Wed, 18 Mar 2020 12:10:04 +0900 Subject: [PATCH] =?UTF-8?q?Update=20002=5F=EC=A7=88=EB=B3=B8=5F=ED=98=84?= =?UTF-8?q?=ED=99=A9=ED=81=AC=EB=A1=A4=EB=A7=81.ipynb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...355\201\254\353\241\244\353\247\201.ipynb" | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git "a/002. korea_cumulative_data_crwler/002_\354\247\210\353\263\270_\355\230\204\355\231\251\355\201\254\353\241\244\353\247\201.ipynb" "b/002. korea_cumulative_data_crwler/002_\354\247\210\353\263\270_\355\230\204\355\231\251\355\201\254\353\241\244\353\247\201.ipynb" index dc6109e..7aebf64 100644 --- "a/002. korea_cumulative_data_crwler/002_\354\247\210\353\263\270_\355\230\204\355\231\251\355\201\254\353\241\244\353\247\201.ipynb" +++ "b/002. korea_cumulative_data_crwler/002_\354\247\210\353\263\270_\355\230\204\355\231\251\355\201\254\353\241\244\353\247\201.ipynb" @@ -55,6 +55,7 @@ } ], "source": [ + "import requests\n", "from bs4 import BeautifulSoup\n", "from urllib.request import urlopen\n", "import urllib.request\n", @@ -83,10 +84,48 @@ "tot.append(num)\n", "tot = pd.DataFrame(tot)\n", "\n", - "tot.rename(columns={tot.columns[0] : status[0],\n", + "tot1 = tot.rename(columns={tot.columns[0] : status[0],\n", " tot.columns[1] : status[1],\n", " tot.columns[2] : status[2],\n", - " tot.columns[3] : status[3]})" + " tot.columns[3] : status[3]})\n", + "\n", + "tot1" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "# 크롤링 시간\n", + "url = 'http://ncov.mohw.go.kr/'\n", + "\n", + "response = requests.get(url)\n", + "soups = BeautifulSoup(response.content, 'html.parser')\n", + "\n", + "update_time = soups.find(\"span\", class_=\"livedate\").text" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "업데이트 시간 : (3.18. 00시 기준, 1.3 이후 누계)\n", + " 확진환자 격리해제 격리중 사망\n", + "0 8,413 1,540 6,789 84\n" + ] + } + ], + "source": [ + "# 출력\n", + "print(\"업데이트 시간 : \",update_time)\n", + "print(tot1)" ] } ], @@ -106,7 +145,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.6" + "version": "3.7.1" } }, "nbformat": 4,