这是我目前拥有的字符串:
URL = "location.href='agent_specific_listing.php?sid=131184&mls=693010&a=103&site_id=540&page_current=1';"
我试图将子字符串用单引号引起来,以便得到结果:
new_url = 'agent_specific_listing.php?sid=131184&mls=693010&a=103&site_id=540&page_current=1'
我尝试使用re和findall,但是我得到了空字符串:
print(re.findall(r"\(u'(.*?)',\)", URL)) // printed empty lists
请让我知道我在做什么错。非常感谢。
print re.findall(r"\'(.*?)\'", URL)
因为这是您处理单引号的方式:
\' matches a literal '
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句