标签: python
line=[::1]:12345
如何在python中使用正则表达式单独提取::1和12345?
::1
12345
答案 0 :(得分:1)
line='[::1]:12345' import re match = re.findall(r'::\d+|(?<=:)\d{2,}', line) print(match)
出:
['::1', '12345']