반응형 파이썬 정규식1 Python regular expression match and search methods Long story short, match and search methods can be used whether to search the beginning of the string or the entire string. Let's dig into an example. import re data = ["ESA1-XXX-XXX - Po1", "ESA1-XXX-XXX - PO1"] for elem in data: m = re.search('(Po|PO)\d', elem).group() What I want to do is to find and replace "- Po1" or "- PO1" to "(Po1)" or "(PO1)". In order to find a certain pattern, I use re.. 2020. 3. 24. 이전 1 다음 반응형