공부
[Python] contains HashSet
승가비
2020. 6. 26. 00:57
728x90
>>> l = set()
>>> l.add(1)
>>> l.add(2)
>>> 1 in l
True
>>> 34 in l
False
https://stackoverflow.com/questions/26724002/contains-of-hashsetinteger-in-python
Contains of HashSet in Python
In Java we have HashSet, I need similar structure in Python to use contains like below: A = [1, 2, 3] S = set() S.add(2) for x in A: if S.contains(x): print "Example" C...
stackoverflow.com
728x90