各位大佬,我现在尝试对返回的结果切片,但是一直返回如题的报错,何解?
response = requests.get(head_url, headers=headers)
print(response)
soup = Bs4(response.content, "html.parser")
print(soup)
soup1 = soup.split('url')
print(soup1)
以下是打印出的soup内容
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="NO-CACHE" http-equiv="PRAGMA"/>
<script>
function redirectOnLoad() {
var escapedHash = '';
var url = '/saml/authn-request.jsp?saml_request_id=_2CAAAAW6NkFa5ME8wMEkwMDAwMDA4T0k1AAAA3uVxW4A-puDiWV7jZg4vzIJ8Kruhb9ezWoJrOJYXNUsMN8S5EhLoi_ruRrvfO5oXTbVtclAH9Oy5BfY6VFY9aF0SmypuZsR0UzxMQUsmdJnM4IHrsrhunYEgpkXPPkir6L8EfEYWsKVxnykLFK-I9w5R0mc8n5yaIPcPcW4g-jTMdzhh1lukUvHn88CqNeWC7fkDAiYj9pApLmZhXQE71rP-DVuQ4tBNJtSHe3WiuLAac3BqZbQALbZz7pHKoEWLmg&saml_acs=https%3A%2F%2Fenglish1.my.salesforce.com%3Fso%3D00D28000000bkxy&saml_binding_type=HttpRedirect&Issuer=https%3A%2F%2Fenglish1.my.salesforce.com&samlSsoConfig=0LE28000000Gr3E&RelayState=%2Fp%2Fown%2FOrgSharingDetail%3Fst%3D01I28000001nyrv%26setupid%3DSecuritySharing';
if (window.location.hash) {
escapedHash = '%23' + window.location.hash.slice(1);
}
if (window.location.replace){
window.location.replace(url + escapedHash);
} else {
window.location.href = url + escapedHash;
}
}
redirectOnLoad();
</script>
</head>
</html>
<!-- Body events -->
<script type="text/javascript">function bodyOnLoad(){if(window.PreferenceBits){window.PreferenceBits.prototype.csrfToken="null";};}function bodyOnBeforeUnload(){}function bodyOnFocus(){}function bodyOnUnload(){}</script>
<!--
...................................................................................................
...................................................................................................
...................................................................................................
...................................................................................................
-->