How to find all the string that end with specific letter in a list with Python

1 Answer

0 votes
import re

lst = ["swift", "python", "javascript", "java", "t", "tt"]

for s in lst:
    match = re.match(".+t\Z", s)
    if match:
        print(s)


'''
run:

swift
javascript
tt

'''

 



answered Sep 2, 2018 by avibootz
...