用交互方法定义重新编译的模式

2024-10-01 11:24:26 发布

您现在位置: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])

Tags: 代码用户re编程模式openusersfile
1条回答
网友
1楼 · 发布于 2024-10-01 11:24:26

在交互式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])

相关问题 更多 >