>>> x=[("x1","x2","x3"),("x1","x2"),("x2","x3"),("x3","x4")]
>>> x
[('x1', 'x2', 'x3'), ('x1', 'x2'), ('x2', 'x3'), ('x3', 'x4')]
I want to delete the tuple in the list--x ,if len(x[id])==3
,len(x[0]==3)
,so it will be deleted ,[('x1', 'x2'), ('x2', 'x3'), ('x3', 'x4')]
is what i wanted,how can i write the code?
[del element if len(element[id]==3) for id,element in enumerate(x)]
invalid syntax.