BeautifulSoup: pobierz klasy css z html
Czy istnieje sposób na uzyskanie klas CSS z pliku HTML za pomocą BeautifulSoup? Przykładowy fragment:
<style type="text/css">
p.c3 {text-align: justify}
p.c2 {text-align: left}
p.c1 {text-align: center}
</style>
Idealnym wyjściem byłoby:
cssdict = {
'p.c3': {'text-align':'justify'},
'p.c2': {'text-align:'left'},
'p.c1':{'text-align':'center'}
}
chociaż coś takiego by się udało:
L = [
('p.c3', {'text-align': 'justify'}),
('p.c2', {'text-align': 'left'}),
('p.c'1, {'text-align': 'center'})
]