Pattern Matching Over Python Lists

Chris chrisspen at gmail.com
Tue Jun 17 01:55:52 EDT 2008


Is anyone aware of any prior work done with searching or matching a
pattern over nested Python lists? I have this problem where I have a
list like:

[1, 2, [1, 2, [1, 7], 9, 9], 10]

and I'd like to search for the pattern [1, 2, ANY] so that is returns:

[1, 2, [1, 2, [6, 7], 9, 9], 10]
[1, 2, [6, 7], 9, 9]



More information about the Python-list mailing list