当前位置:网站首页>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
边栏推荐
猜你喜欢
一个新的微型ORM开源框架
利用HashMap实现简单缓存
C language Essay 1
Binary search basis
嵌入式数据库开发编程(五)——DQL
Shell Sort
To be continued] [UE4 notes] L4 object editing
Support multi-mode polymorphic gbase 8C database continuous innovation and heavy upgrade
Django reports an error when connecting to the database. What is the reason
Fragment addition failed error lookup
随机推荐
kubeadm系列-02-kubelet的配置和启动
Solon 框架如何方便获取每个请求的响应时间?
What is the agile proportion of PMP Exam? Dispel doubts
[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research
The present is a gift from heaven -- a film review of the journey of the soul
【论文笔记】Multi-Goal Reinforcement Learning: Challenging Robotics Environments and Request for Research
[轉]: OSGI規範 深入淺出
Stm32cubemx (8): RTC and RTC wake-up interrupt
object serialization
Pointnet++学习
嵌入式数据库开发编程(五)——DQL
Research on the value of background repeat of background tiling
Web APIs DOM node
使用Room数据库报警告: Schema export directory is not provided to the annotation processor so we cannot expor
Reflection summary of Haut OJ freshmen on Wednesday
GBase数据库助力湾区数字金融发展
Bucket sort
Add level control and logger level control of Solon logging plug-in
利用HashMap实现简单缓存
Haut OJ 1245: large factorial of CDs --- high precision factorial