案例1
html = '<input type="hidden" id="UserName" value="242320">'
- 假如要获取"242320"这个值,该如何实现?
pattern = r'<input type="hidden" id="UserName" value="(*?.)">'
result = re.findall(pattern, html)
- 完整代码
import re
if __name__ == '__main__':
html = '<input type="hidden" id="UserName" value="242320">'
pattern = r'<input type="hidden" id="UserName" value="(.*?)">'
result = re.findall(pattern, html)
print(result)
网友评论