Issue
Is there a way to compare identical values between two lists and print them in order?
a = ["C4", "B5", "D5", "C6"]
b = ["C0", "B2", "C4", "C6"]
I know of set(a).intersection(b)
but it does not print in order (values are mixed in different places)
Help is highly appreciated! :)
Solution
one simple line
[item for item in a if item in b]
Answered By - WSUN000
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.