Skip to content

Commit b6de168

Browse files
committed
Improve the README.rst file
1 parent b51975a commit b6de168

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

README.rst

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
===============================
1+
======
22
Parsel
3-
===============================
3+
======
44

55
.. image:: https://img.shields.io/travis/scrapy/parsel/master.svg
66
:target: https://travis-ci.org/scrapy/parsel
@@ -15,21 +15,16 @@ Parsel
1515
:alt: Coverage report
1616

1717

18-
Parsel is a library to extract data from HTML and XML using XPath and CSS selectors
18+
Parsel is a BSD-licensed Python_ library to extract data from HTML_ and XML_
19+
using XPath_ and CSS_ selectors, optionally combined with
20+
`regular expressions`_.
1921

20-
* Free software: BSD license
21-
* Documentation: https://parsel.readthedocs.org.
22+
Find the Parsel online documentation at https://parsel.readthedocs.org.
2223

23-
Features
24-
--------
25-
26-
* Extract text using CSS or XPath selectors
27-
* Regular expression helper methods
28-
29-
Example::
24+
.. code-block:: python
3025
3126
>>> from parsel import Selector
32-
>>> sel = Selector(text=u"""<html>
27+
>>> selector = Selector(text=u"""<html>
3328
<body>
3429
<h1>Hello, Parsel!</h1>
3530
<ul>
@@ -38,14 +33,18 @@ Example::
3833
</ul
3934
</body>
4035
</html>""")
41-
>>>
42-
>>> sel.css('h1::text').get()
36+
>>> selector.css('h1::text').get()
4337
'Hello, Parsel!'
44-
>>>
45-
>>> sel.css('h1::text').re('\w+')
38+
>>> selector.xpath('//h1/text()').re(r'\w+')
4639
['Hello', 'Parsel']
47-
>>>
48-
>>> for e in sel.css('ul > li'):
49-
... print(e.xpath('.//a/@href').get())
40+
>>> for li in selector.css('ul > li'):
41+
... print(li.xpath('.//@href').get())
5042
http://example.com
5143
http://scrapy.org
44+
45+
.. _CSS: https://en.wikipedia.org/wiki/Cascading_Style_Sheets
46+
.. _HTML: https://en.wikipedia.org/wiki/HTML
47+
.. _Python: https://www.python.org/
48+
.. _regular expressions: https://docs.python.org/library/re.html
49+
.. _XML: https://en.wikipedia.org/wiki/XML
50+
.. _XPath: https://en.wikipedia.org/wiki/XPath

0 commit comments

Comments
 (0)