Answers for "intersection python dict"

-1

intersection python dict

Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = {'a': 123, 'c': 5}
>>> b = {'a': 2, 'b': 4}
>>> a.keys() & b.keys()  # intersection
{'a'}
>>> a.keys() ^ b.keys()  # difference
{'b', 'c'}
>>> a.keys() - b.keys()  # subtraction
{'c'}
Posted by: Guest on February-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language