diff --git a/lab6/pyweb.ipynb b/lab6/pyweb.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..e97b40998e2db6a0603b299242efb3c15a4b4fdd --- /dev/null +++ b/lab6/pyweb.ipynb @@ -0,0 +1,43 @@ +{ + "cells": [ + { + "metadata": { + "trusted": true + }, + "cell_type": "code", + "source": "import requests\nfrom bs4 import BeautifulSoup\npage = requests.get(\"http://forecast.weather.gov/MapClick.php?lat=37.7772&lon=-122.4168\")\nsoup = BeautifulSoup(page.content, 'html.parser')\nseven_day = soup.find(id=\"detailed-forecast-body\")\nforecast_items = seven_day.find_all(class_=\"row row-odd row-forecast\")\nforecast_items2 = seven_day.find_all(class_=\"row row-even row-forecast\")\ntonight = forecast_items[0]\ntonight2 = forecast_items2[0]\n\nx=list(tonight.children)[0]\nprint(x)\nprint(list(x.children)[0].get_text())\nprint(\"---------------------------------------------------------\")\nprint(tonight.prettify())\nprint(tonight2.prettify())", + "execution_count": null, + "outputs": [] + }, + { + "metadata": { + "trusted": true + }, + "cell_type": "code", + "source": "", + "execution_count": null, + "outputs": [] + } + ], + "metadata": { + "kernelspec": { + "name": "python36", + "display_name": "Python 3.6", + "language": "python" + }, + "language_info": { + "mimetype": "text/ x - python", + "nbconvert_exporter": "python", + "version": "3.6.0", + "name": "python", + "file_extension": ".py", + "pygments_lexer": "ipython2", + "codemirror_mode": { + "version": 2, + "name": "ipython" + } + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} \ No newline at end of file