1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

allow adding values to existing dict

This commit is contained in:
Mike Fährmann 2015-11-03 00:05:18 +01:00
parent 629133a27a
commit d0bebd9ce3
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -80,9 +80,10 @@ def extract(txt, begin, end, pos=0):
except ValueError:
return None, pos
def extract_all(txt, rules, pos=0):
def extract_all(txt, rules, pos=0, values=None):
"""Calls extract for each rule and returns the result in a dict"""
values = {}
if values is None:
values = {}
for key, begin, end in rules:
result, pos = extract(txt, begin, end, pos)
if key: