mirror of https://github.com/scrapy/scrapy.git
added docstring
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40394
This commit is contained in:
parent
1458686cbf
commit
d4040d73d9
|
|
@ -30,6 +30,18 @@ def xmliter(obj, nodename):
|
|||
yield XmlXPathSelector(text=nodetext).x('/' + nodename)[0]
|
||||
|
||||
def csviter(obj, delimiter=None, headers=None):
|
||||
""" Returns an iterator of dictionaries from the given csv object
|
||||
|
||||
obj can be:
|
||||
- a Response object
|
||||
- a unicode string
|
||||
- a string encoded as utf-8
|
||||
|
||||
delimiter is the character used to separate field on the given obj.
|
||||
|
||||
headers is an iterable that when provided offers the keys
|
||||
for the returned dictionaries, if not the first row is used.
|
||||
"""
|
||||
def _getrow(csv_r):
|
||||
return [field.decode() for field in csv_r.next()]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue