티스토리 뷰

공부

[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

'공부' 카테고리의 다른 글

[Sh] sleep  (0) 2020.06.26
[Python] regexp split  (1) 2020.06.26
[Kafka] basic  (0) 2020.06.18
[SQL] pivot table  (0) 2020.06.18
[Hive] SHOW TABLES FROM `db`  (0) 2020.06.18
댓글