Advertisement
here2share

# string_endswith_various_values.py

May 6th, 2015
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. # string_endswith_various_values.py
  2.  
  3. vals="""
  4. abc.001
  5. abc001
  6. abc.002
  7. abc.xyz
  8. abcxyz
  9. abc.003
  10. xyz.001
  11. xyz.002
  12. xyz002
  13. 001.xyz
  14. 123.001
  15. .001
  16. 123.002
  17. .002xyz
  18. 003.003
  19. xyz.003
  20. .001234
  21. abc.abc
  22. 001x002
  23. """
  24.  
  25. vals=vals.split()
  26.  
  27. for val in vals:
  28.     if val.endswith(('.001','.002','xyz')):
  29.         print val
  30.  
  31. print
  32. print 'Done!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement