Using dictionary to hold regex patterns?

Gilles Ganault nospam at nospam.com
Sun Nov 23 14:55:16 EST 2008


On Sun, 23 Nov 2008 17:55:48 +0000, Arnaud Delobelle
<arnodel at googlemail.com> wrote:
>But there is no reason why you should use a dictionary; just use a list
>of key-value pairs:
>
>patterns = [
>    ("pattern1", re.compile(">.+?</td>.+?>(.+?)</td>"),

Thanks for the tip, but... I thought that lists could only use integer
indexes, while text indexes had to use dictionaries. In which case do
we need dictionaries, then?



More information about the Python-list mailing list