BeautifulSoup과 함께 scrapy을 사용하여 땜질을 시작했습니다. 매우 명확한 것이 빠져 있는지 궁금하지만, 반환 된 doctype을 얻는 방법을 찾지 못했습니다. html 문서를 생성합니다. BeautifulSoup로를 사용에서 선언 된 문서 타입을 추출하는 방법이 경우문서 가져 오기 DOCTYPE with BeautifulSoup
이<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta charset=utf-8 />
<meta name="viewport" content="width=620" />
<title>HTML5 Demos and Examples</title>
<link rel="stylesheet" href="/css/html5demos.css" type="text/css" />
<script src="js/h5utils.js"></script>
</head>
<body>
<p id="firstpara" align="center">This is paragraph <b>one</b>
<p id="secondpara" align="blah">This is paragraph <b>two</b>.
</html>
사람이 말해 줄 수 :
는 다음과 같은 HTML을 감안할 때?
doctype이 첫 번째 항목이 아니라면이 구문은 깨질 것이다. 예를 들어, 문서 맨 위에 xml 선언이있는 경우. – karlcow
doctype이 누락되어있을 수 있고 그럴 수 있기 때문에 아무 것도 반환 할 수 없습니다. – zvone