Guest User

ㅅㄹㅅㅅ

a guest
Sep 14th, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. import re
  2.  
  3. l1 = ["abc", "abx", "bcd", "bcbdd", "f21fa", "f14"]
  4. print("Origin:\n",l1)
  5.  
  6. l2 = list(filter(lambda x:re.match("ab|bc.*", x), l1))
  7. print("Filtered:\n",l2)
  8.  
  9. > Origin:
  10. > ['abc', 'abx', 'bcd', 'bcbdd', 'f21fa', 'f14']
  11. > Filtered:
  12. > ['abc', 'abx', 'bcd', 'bcbdd']
Advertisement
Add Comment
Please, Sign In to add comment