I have a list named rule.start. In this list, all elements are equal to an element from another list called com.empty. I want the element from rule.start to be replaced by the element that comes AFTER the same element from com.empty. How would I do this?
rule.start looks like this:
['F', 'L', 'G', 'L', 'F', 'R', 'F', 'R', 'F', 'L', 'G', 'L', 'F', 'L', 'F', 'L', 'G', 'L', 'F', 'L',........]
com.empty looks like this:
['F', ['fd'], 'G', ['fd'], 'L', ['lt', '60'], 'R', ['rt', '60']]
I have tried this:
wut = 0
for elem in rule.start:
v = 1
for mel in com.empty[::2]:
if elem == mel:
rule.start[wut] = com.empty[v]
print elem
print mel
wut +=1
v += 2
But it just replaces all element of rule.start with ['fd']
In the end, I want to evaluate all elements as commands, that looks like this: fd(var, scale)
and this: rt(var, 60) # 60 is from the list.
{'F': ['fd'], 'G': ['fd'], 'L': ['lt', '60'], 'R': ['rt', '60']}?