How to remove adjacent duplicate elements in a list using list comprehensions? [duplicate]
问题 This question already has answers here : Remove adjacent duplicate elements from a list [duplicate] (17 answers) Closed 4 years ago . Is there a way to use list comprehensions in python to filter adjacent duplicates from a list? Here's an example of what I mean: >>> xs = [1,2,2,3] >>> print added.reAdj(xs) [1,2,3] A search through SE revealed an earlier inquiry asking a similar but slightly different question: whether all duplicates could be removed from a list, but not explicitly asking for