How to separate words that start with specific letter from a string into a list in Python

1 Answer

0 votes
import re

s = "java python c++ php 123 c# programming"

lst = re.findall("[p]\w+", s)

print(lst)


'''
run:

['python', 'php', 'programming']

'''

 



answered Aug 31, 2018 by avibootz
...