I'm trying to compare two lists using set. Problem is my lists are not in the right format. When the lists are compared using set, the result individually breaks down each number instead of each integer.
a = "[1554901200, 1554251400, 1554253200, 1554255000]"
b = "[1554901200, 1554251400, 1554253200]"
print(set(a)& set(b))
>>> set([' ', ',', '1', '0', '3', '2', '5', '4', '9'])
I would like the answer to be:
>>> set([1554901200, 1554251400, 1554253200])
or I would like to find a way to format the list so that set could analyze each rather then
a = ["1554901200", "1554251400", "1554253200", "1554255000"]
set([1554901200, 1554251400, 1554253200]).a = ...you have strings, but the first time you have numbers. These will give very different results. which do you have?