Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # list_substring_divider.py
- words = ['one', 'two', 'abc','123', 'xyz']
- string = 'python thirty-two three phone# 12 $123.45 two a-b-c'.split()
- zzz=[]
- found=[]
- nil='' # ? Maybe fixed in Python 3
- for s in string: (found if [nil for word in words if word in s] else zzz).append(s)
- print('Items Found In String: %s' % (found))
- print('Items Not Found In String: %s' % (zzz))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement