How to extract substrings between single quotes in Python

1 Answer

0 votes
import re

string = "Python is a high-level 'interpreted' general-purpose 'programming language'"

lst = re.findall(r"'([^']*)'", string)

print(lst) 




'''
run:

['interpreted', 'programming language']

'''

 



answered Jul 26, 2022 by avibootz

Related questions

...