【发布时间】:2019-10-11 13:26:00
【问题描述】:
所以我试图从 html 中的对象中获取一个值。我已经找到了获取价值的方法,但是添加了一些我不想要的额外内容。
我尝试过使用 .split() 和组,但它们都没有做任何事情。
html = r.text
checkouttoken = re.search('DF_CHECKOUT_TOKEN = (.*?);', html, re.S)
print(checkouttoken.group(0))
预期:
27f37949bb8a76ede81508c8c1b750c8
实际:
< iframe srcdoc="<script>!function(){var e=function(e){var t={exports:{}};return e.call(t.exports,t,t.exports),t.exports},r=function(){fun
DF_CHECKOUT_TOKEN = "27f37949bb8a76ede81508c8c1b750c8";
【问题讨论】:
标签: python regex regex-lookarounds regex-group regex-greedy