Hi!

In [69]: a = 'a b c'
In [70]: b = 'a b, c d'

In [74]: [i for i in a.split() if i not in b.split()]
Out[74]: ['b']

Everything ok.

In [77]: b.split() == [i for i in b.split()]
Out[77]: True

As expected. Now, put this in the first list comprehension:

In [80]: [i for i in a.split() if i not in [i for i in b.split()] ]
Out[80]: ['d']

Hmmmm... why is that?

Regards!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to