有什么快的办法?能把141.24.249.130提取出来
Fwd'd * Reg *
Query *
1 planetlab2.fem.tu-ilmenau.de
141.24.249.130 * no transit
summary failed sees 171
287 avoiding 20.6 D
7.5 D 121
0 2.48
正则表达式
(\d+\.){3}\d+
方法-2:
import re
text = '''
asb sdwe 1.1
123.123.123.567 get ip
test data
'''
lines = text.split("\n")
for line in lines:
g = re.compile(r"^.*?([0-9]+[.][0-9]+[.][0-9]+[.][0-9]+).*$").match(line)
if g<> None:
print g.groups(1)[0]