当前位置:网站首页>lxml. etree. XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
lxml. etree. XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
2022-07-05 05:24:00 【Star and Dream Star_ dream】
Python Reptiles Problems encountered in :
Python Code ( There's nothing wrong with it , yes HTML There is a problem with the document )
from lxml import etree # Access to the local HTML file html = etree.parse(r" test .html") result = etree.tostring(html, encoding='utf-8').decode('utf-8') print(result)
HTML file ( Error message )
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>etree Of parse Method </title> </head> <body> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> <li>10</li> </ul> </body> </html>
Solution :
Focus on modifying this part
After modification :
<meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
Add “/” Number
Successful execution :
End
边栏推荐
- Web APIs DOM节点
- [depth first search] 695 Maximum area of the island
- TF-A中的工具介绍
- Es module and commonjs learning notes -- ESM and CJS used in nodejs
- Kali 2018 full image download
- Haut OJ 2021 freshmen week II reflection summary
- Stm32cubemx (8): RTC and RTC wake-up interrupt
- room数据库的使用
- When will Wei Lai, who has been watched by public opinion, start to "build high-rise buildings" again?
- Haut OJ 1321: mode problem of choice sister
猜你喜欢
随机推荐
Romance of programmers on Valentine's Day
对象的序列化
Haut OJ 1241: League activities of class XXX
[allocation problem] 455 Distribute cookies
What is the agile proportion of PMP Exam? Dispel doubts
YOLOv5-Shufflenetv2
Haut OJ 1401: praise energy
A new micro ORM open source framework
Remote upgrade afraid of cutting beard? Explain FOTA safety upgrade in detail
Simple HelloWorld color change
挂起等待锁 vs 自旋锁(两者的使用场合)
Developing desktop applications with electron
[merge array] 88 merge two ordered arrays
Do a small pressure test with JMeter tool
64 horses, 8 tracks, how many times does it take to find the fastest 4 horses at least
使用命令符关闭笔记本自带键盘命令
使用Electron开发桌面应用
Csp-j-2020-excellent split multiple solutions
[sum of two numbers] 169 sum of two numbers II - enter an ordered array
room数据库的使用