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

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -