I have a interesting problem. I have a list of lists, and I want all except the first element of each list compiled into a regular expression. And then put back into the list. The lists start as strings.
The following code doesn't work. It doesn't raise an error, it just doesn't seem to do anything. I think I have identified the problem. (see below)
Code:
for i in range(len(groups)):
for j in range(len(groups[i][1:])):
groups[i][1:][j] = re.compile(groups[i][1:][j])
The problem as I see it is that, while list[1:] = [1,2,3]
works, list[1:][1] = 2
does not work.
What would an appropriate fix be?