import sqlite3
import requests
from lxml import html
from lxml import etree
from datetime import datetime
def log(*s):
print("{0} [LOG]:".format(datetime.now()), *s)
def main():
r = requests.get("https://www.av ito.ru/krasnodar/avtomobili/vaz_lada?view=list&radius=0&s_trg=3&f=188_893b&i=1")
if r.status_code != 200:
log("Status code check fail: {}".format(r.status_code))
tree = html.fromstring(r.text)
res = []
l = tree.xpath('//div[@itemtype="http://sch ema.org/Product"]')
for p in l:
id = p.attrib.get('id')
price = p.xpath('.//p[@itemprop="price"]')[0].attrib.get('content')
mileage = p.xpath('div[@class="mileage"]')[0].text
desc = p.xpath('meta[@itemprop="description"]')[0].attrib.get('content')
res.append((id, mileage, desc))
if name == "main":
main()
import requests
from lxml import html
from lxml import etree
from datetime import datetime
def log(*s):
print("{0} [LOG]:".format(datetime.now()), *s)
def main():
r = requests.get("https://www.av ito.ru/krasnodar/avtomobili/vaz_lada?view=list&radius=0&s_trg=3&f=188_893b&i=1")
if r.status_code != 200:
log("Status code check fail: {}".format(r.status_code))
tree = html.fromstring(r.text)
res = []
l = tree.xpath('//div[@itemtype="http://sch ema.org/Product"]')
for p in l:
id = p.attrib.get('id')
price = p.xpath('.//p[@itemprop="price"]')[0].attrib.get('content')
mileage = p.xpath('div[@class="mileage"]')[0].text
desc = p.xpath('meta[@itemprop="description"]')[0].attrib.get('content')
res.append((id, mileage, desc))
if name == "main":
main()
Jupyter Notebook
python -m pip install --upgrade pip
python -m pip install jupyter
pip install numpy pandas scikit-learn matplotlib seaborn
jupyter notebook
python -m pip install --upgrade pip
python -m pip install jupyter
pip install numpy pandas scikit-learn matplotlib seaborn
jupyter notebook
NumPy — для работы с однородными данными в виде массивов
Pandas — для работы с неоднородными и поименованными данными
SciPy — для общих научных вычислительных задач
Matplotlib — для визуализаций типографского качества
IPython — для интерактивного выполнения и совместного использования кода
Scikit-Learn — для машинного обучения и множества других инструментов
Pandas — для работы с неоднородными и поименованными данными
SciPy — для общих научных вычислительных задач
Matplotlib — для визуализаций типографского качества
IPython — для интерактивного выполнения и совместного использования кода
Scikit-Learn — для машинного обучения и множества других инструментов
Jupyter - автодополнение по Tab (It will also complete filenames in the current directory)
? -> Introduction and overview of IPython's features (this screen).
object? -> Details about 'object'.
object?? -> More detailed, verbose information about 'object'.
%quickref -> Quick reference of all IPython specific syntax and magics.
help -> Access Python's own help system.
object? -> Details about 'object'.
object?? -> More detailed, verbose information about 'object'.
%quickref -> Quick reference of all IPython specific syntax and magics.
help -> Access Python's own help system.
_ih - список последних команд, _i - запуск последней команды, _ii - предпоследней и т.д.
%timeit x=10 : time the 'x=10' statement with high precision.
%%timeit x=2**100
x**100
Time 'x**100' with a setup of 'x=2**100'; setup code is not counted. This is an example of a cell magic.
%%timeit x=2**100
x**100
Time 'x**100' with a setup of 'x=2**100'; setup code is not counted. This is an example of a cell magic.