Skip to content

Instantly share code, notes, and snippets.

View promsoft's full-sized avatar

Dmitry Kolodezev promsoft

View GitHub Profile
@promsoft
promsoft / html2txt.py
Last active February 18, 2017 18:24
Get text from html
import requests
html = requests.get('https://promsoft.ru').text
from bs4 import BeautifulSoup
from bs4.element import NavigableString
def html2txt(html):
soup = BeautifulSoup(html, 'lxml')
for elem in soup.findAll(['script', 'style']):
a = []
padd = [0]*9
source = list(range(7))
def logic(a):
a = a + padd
if a[0] + a[1] + a[2] > 13:
return False
if a[3] + a[4] + a[5] > 13:
return False
if a[6] + a[7] + a[8] > 13: