如何在Python 3中做到这一点。例如:
列表 = ["123456781234567812345678","123456781234567812345678"]
进入这个: [[12345678","12345678","12345678],["12345678","12345678","12345678"]]
谢谢
使用正则表达式,您可以编写:
import re
alist = ['123456781234567812345678','123456781234567812345678']
reg = re.compile('12345678')
print([reg.findall(elem) for elem in alist])
# [['12345678', '12345678', '12345678'], ['12345678', '12345678', '12345678']]