I want to create map data from 2 list data. I have a simple example like below. What I want to do is create 'new_map' data like below. If it contains specific data, the value should be True.
all_s = ['s1', 's2', 's3', 's4']
data = ['s2', 's4']
new_map = {'s1': False, 's2': True, 's3': False, 's4': True}
Are there any smart way (like lambda) to implement this? My python env is 3.X. Of course I can resolve this problem if I use for-iter simply. But I wonder there are better ways.
True if (s in data) else Falseis the same ass in dataonly more verbose.