S
S
Sergey Pavlov2014-07-12 20:42:35
css
Sergey Pavlov, 2014-07-12 20:42:35

How to parse a certain piece of code?

<html>
<body>
<div id=new_class1>
<style type="text/css"> ..... </style>
<p> Раз </p>
Два
<> Три </p>
<div class="new_class2>....</div>
</div>
</body>
</html>

You need to parse all the html from <style type="text/css">to <div class="new_class2>....</div>to get:
One
Two
Three
How can this be done in python?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Timofeev, 2016-03-28
@webinar

Put them in a container with a width of 100000 px

D
Dmitry Belyaev, 2016-03-28
@bingo347

So? codepen.io/bingo347/pen/JXJeJy

V
Vladimir Kuts, 2014-07-12
@fox_12

It's hard to read line by line. The lines between <style type="text/css">and <div class="new_class2>....</div>drive into a separate array, and parse it. For example, remove tags with regular expressions, leaving the text

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question