9
Is there a way to get CSS classes from an HTML file using BeautifulSoup? Example snippet:
<style type="text/css">
p.c3 {text-align: justify}
p.c2 {text-align: left}
p.c1 {text-align: center}
</style>
Perfect output would be:
cssdict = {
'p.c3': {'text-align': 'justify'},
'p.c2': {'text-align': 'left'},
'p.c1': {'text-align': 'center'}
}
although something like this would do:
L = [
('p.c3', {'text-align': 'justify'}),
('p.c2', {'text-align': 'left'}),
('p.c1', {'text-align': 'center'})
]