Faqts : Business : Programming : Shopping For You : Python : Common Problems : Lists

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 13 people (100%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

How do you show the differences between two lists? Ex: range(0,5) & range(2,4)=[0,1,4]

Feb 1st, 2007 13:28
Miguel Ángel Alarcos, subscriber 123,


a=range(0,5)
b=range(2,4)
[i for i in a if i not in b] + [i for i in b if i not in a]