How to subtract unkown strings from list in python -


i trying write program it, on call me jason, convert list , subtract jason list. managed make but, want subtract words aren't in there able if there.

you haven't posted code, here how it.

names = set(['john','jason','jim'])  callme = 'jason'  names.intersection(set([callme])) 

alternatively, iterators

names = ['john','jason','jim']  callme = ['jason']  [n n in names if n in callme] 

Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -