通过交互方法

时间:2017-10-06 18:15:50

标签: python

我是python编程的新手,如果我需要输入整数2468来编译模式作为用户交互模式,请告诉我需要做哪些更改。

代码:

f = open ('C:\\Users\\anash\\Desktop\\SIP Success call.txt')
file = f.read()

import re
regex1 = re.compile(r'INVITE sip:.*?**2468**.*?Content-Length: \d+',re.DOTALL)

filtfile = regex1.findall(file)
print (filtfile[0])

1 个答案:

答案 0 :(得分:0)

在交互式shell中,输入以下内容:

>>> import re
>>> regex1 = re.compile(r'INVITE sip:.*?**2468**.*?Content-Length: \d+',re.DOTALL)
>>> filtfile = regex1.findall("Any input you want to enter")
>>> print(filtfile[0])