使用python regex重新编译匹配

2024-09-27 21:30:53 发布

您现在位置:Python中文网/ 问答频道 /正文

eag = 'linux'
rpat = re.compile("^\s*%s\s*=\s*('.*\'')" % eag)

试图在文本文件的一行中抓取r'^LIN'linux = r'^LIN',

^{pr2}$

不太确定我的rpat是否正确
在linux前面有一些空间,然后是一些空间,直到=然后是一些空间r'^LIN'


Tags: relinux空间文本文件compilelinpr2rpat
1条回答
网友
1楼 · 发布于 2024-09-27 21:30:53

相反,通过参数,您应该通过属性将数据放入HttpRequest

// In the filter:
request.setAttribute("name", new MyObject());

// In the JSP:
MyObject obj=(MyObject)request.getAttribute("name");

相关问题 更多 >

    热门问题