This works: allDasTickets = ['9255955', '9255958', '9255960', '9255977'] [[j for j in allDasTickets if x != j] for x in allDasTickets] ['9255958', '9255960', '9255977'] ['9255955'
Solution 1:
For list comprehensions, the syntax is
[ <something> for elem in sequence]
Where <something> can itself be a list comprehension. Meanwhile, for nested loop (but not nested lists) comprehensions, the syntax is
Post a Comment for "Understanding The Syntax Of List Comprehensions (and Nested Lcs)"