s= Tlike Python3 and like python27运用正则表达式找出字符串s1中的 Python 和 p ython
import re
s1 = "I like Python3 and Python2.7"
matches = re.findall(r'Python|p\sython', s1)
print(matches) # Output: ['Python', 'Python', 'p ython']
原文地址: https://www.cveoy.top/t/topic/eJfx 著作权归作者所有。请勿转载和采集!