Python: best way to find out from which set the results of `symmetric_difference` are from? -


what best practice finding out set results of symmetric_difference from?

intersect = s1.symmetric_difference(s2) 

the result should

{'34':'s1', '66':'s2'}  

where '34','66' unique items.

to cleanly, following should work:

intersect = s1.symmetric_difference(s2) result = dict([(i, ("s1" if in s1 else "s2")) in intersect]) 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -