用python处理html代码的转义与还原 #x27; amp; lt; gt; quot; #x27;等特殊字符
html代码的转义
import html
print(html.escape("""'& < >\"'"""))
' & < > " '
html代码的转义还原
import html
print(html.unescape("'& < >"'"))
'& < >"'
' | ’ |
& | & |
< | < |
> | > |
" | " |
' | ’ |
字母或有些符号等+ ̀ 例 à | à |
字母或有些符号等+ ́ 例 Á | Á |
字母或有些符号等+ ̂例 /̂ | /̂ |
字母或有些符号等+ ̃例 \\̃ | \̃ |
显示结果 | 描述 | 实体名称 | 实体编号 |
---|---|---|---|
| 非间断空格(non-breaking space) | ||
¡ | ¡ | ¡ | 倒置感叹号(inverted exclamation mark) |
¢ | ¢ | ¢ | 美分符号(cent) |
£ | £ | £ | 英镑符号(pound) |
¤ | ¤ | ¤ | 货币符号(currency) |
¥ | ¥ | ¥ | 人民币/日元符号(yen) |
¦ | ¦ | ¦ | 间断的竖杠(broken vertical bar) |
§ | § | § | 小节号(section) |
¨ | ¨ | ¨ | 分音符号(spacing diaeresis) |
© | © | © | 版权所有(copyright) |
ª | ª | ª | 阴性序数记号(feminine ordinal indicator) |
« | « | « | 左双角引号(angle quotation mark (left)) |
¬ | ¬ | ¬ | 否定符号(negation) |
| | ­ | 软连字符(soft hyphen) |
® | ® | ® | 注册商标(registered trademark) |
¯ | ¯ | ¯ | 长音符号(spacing macron) |
° | ° | ° | 度符号(degree) |
± | ± | ± | 加减号/正负号(plus-or-minus) |
² | ² | ² | 上标 2(superscript 2) |
³ | ³ | ³ | 上标 3(superscript 3) |
´ | ´ | ´ | 尖音符号(spacing acute) |
µ | µ | µ | 微米符号(micro) |
¶ | ¶ | ¶ | 段落符号(paragraph) |
· | · | · | 中间点(middle dot) |
¸ | ¸ | ¸ | 变音符号(spacing cedilla) |
¹ | ¹ | ¹ | 上标 1(superscript 1) |
º | º | º | 阳性序数记号(masculine ordinal indicator) |
» | » | » | 右双角引号(angle quotation mark (right)) |
¼ | ¼ | ¼ | 1/4 分数(fraction 1/4) |
½ | ½ | ½ | 1/2 分数(fraction 1/2) |
¾ | ¾ | ¾ | 3/4 分数(fraction 3/4) |
¿ | ¿ | ¿ | 倒置问号(inverted question mark) |
À | À | À | 大写字母 A,重音(grave accent) |
Á | Á | Á | 大写字母 A,尖音(acute accent) |
 |  |  | 大写字母 A,抑扬音(circumflex accent) |
à | à | à | 大写字母 A,腭化(tilde) |
Ä | Ä | Ä | 大写字母 A,带有变音符号标记(umlaut mark) |
Å | Å | Å | 大写字母 A,带有上圆圈(ring) |
Æ | Æ | Æ | 大写字母 AE |
Ç | Ç | Ç | 大写字母 C,变音(cedilla) |
È | È | È | 大写字母 E,重音(grave accent) |
É | É | É | 大写字母 E,尖音(acute accent) |
Ê | Ê | Ê | 大写字母 E,抑扬音(circumflex accent) |
Ë | Ë | Ë | 大写字母 E,带有变音符号标记(umlaut mark) |
Ì | Ì | Ì | 大写字母 I,重音(grave accent) |
Í | Í | Í | 大写字母 I,尖音(acute accent) |
Î | Î | Î | 大写字母 I,抑扬音(circumflex accent) |
Ï | Ï | Ï | 大写字母 I,带有变音符号标记(umlaut mark) |
Ð | Ð | Ð | 冰岛语大写字母 eth |
Ñ | Ñ | Ñ | 大写字母 N,腭化(tilde) |
Ò | Ò | Ò | 大写字母 O,重音(grave accent) |
Ó | Ó | Ó | 大写字母 O,尖音(acute accent) |
Ô | Ô | Ô | 大写字母 O,抑扬音(circumflex accent) |
Õ | Õ | Õ | 大写字母 O,腭化(tilde) |
Ö | Ö | Ö | 大写字母 O,带有变音符号标记(umlaut mark) |
× | × | × | 乘号(multiplication) |
Ø | Ø | Ø | 大写字母 O,带有斜线(slash) |
Ù | Ù | Ù | 大写字母 U,重音(grave accent) |
Ú | Ú | Ú | 大写字母 U,尖音(acute accent) |
Û | Û | Û | 大写字母 U,抑扬音(circumflex accent) |
Ü | Ü | Ü | 大写字母 U,带有变音符号标记(umlaut mark) |
Ý | Ý | Ý | 大写字母 Y,尖音(acute accent) |
Þ | Þ | Þ | 冰岛语大写字母 THORN |
ß | ß | ß | 德语小写字母 sharp s |
à | à | à | 小写字母 a,重音(grave accent) |
á | á | á | 小写字母 a,尖音(acute accent) |
â | â | â | 小写字母 a,抑扬音(circumflex accent) |
ã | ã | ã | 小写字母 a,腭化(tilde) |
ä | ä | ä | 小写字母 a,带有变音符号标记(umlaut mark) |
å | å | å | 小写字母 a,带有上圆圈(ring) |
æ | æ | æ | 小写字母 ae |
ç | ç | ç | 小写字母 c,变音(cedilla) |
è | è | è | 小写字母 e,重音(grave accent) |
é | é | é | 小写字母 e,尖音(acute accent) |
ê | ê | ê | 小写字母 e,抑扬音(circumflex accent) |
ë | ë | ë | 小写字母 e,带有变音符号标记(umlaut mark) |
ì | ì | ì | 小写字母 i,重音(grave accent) |
í | í | í | 小写字母 i,尖音(acute accent) |
î | î | î | 小写字母 i,抑扬音(circumflex accent) |
ï | ï | ï | 小写字母 i,带有变音符号标记(umlaut mark) |
ð | ð | ð | 冰岛语小写字母 eth |
ñ | ñ | ñ | 小写字母 n,腭化(tilde) |
ò | ò | ò | 小写字母 o,重音(grave accent) |
ó | ó | ó | 小写字母 o,尖音(acute accent) |
ô | ô | ô | 小写字母 o,抑扬音(circumflex accent) |
õ | õ | õ | 小写字母 o,腭化(tilde) |
ö | ö | ö | 小写字母 o,带有变音符号标记(umlaut mark) |
÷ | ÷ | ÷ | 除号(division) |
ø | ø | ø | 小写字母 o,带有斜线(slash) |
ù | ù | ù | 小写字母 u,重音(grave accent) |
ú | ú | ú | 小写字母 u,尖音(acute accent) |
û | û | û | 小写字母 u,抑扬音(circumflex accent) |
ü | ü | ü | 小写字母 u,带有变音符号标记(umlaut mark) |
ý | ý | ý | 小写字母 y,尖音(acute accent) |
þ | þ | þ | 冰岛语小写字母 thorn |
ÿ | ÿ | ÿ | 小写字母 y,带有变音符号标记(umlaut mark) |
∀ | ∀ | ∀ | for all |
∂ | ∂ | ∂ | part |
∃ | ∃ | ∃ | exists |
∅ | ∅ | ∅ | empty |
∇ | ∇ | ∇ | nabla |
∈ | ∈ | ∈ | isin |
∉ | ∉ | ∉ | notin |
∋ | ∋ | ∋ | ni |
∏ | ∏ | ∏ | prod |
∑ | ∑ | ∑ | sum |
− | − | − | minus |
∗ | ∗ | ∗ | lowast |
√ | √ | √ | square root |
∝ | ∝ | ∝ | proportional to |
∞ | ∞ | ∞ | infinity |
∠ | ∠ | ∠ | angle |
∧ | ∧ | ∧ | and |
∨ | ∨ | ∨ | or |
∩ | ∩ | ∩ | cap |
∪ | ∪ | ∪ | cup |
∫ | ∫ | ∫ | integral |
∴ | ∴ | ∴ | therefore |
∼ | ∼ | ∼ | similar to |
≅ | ≅ | ≅ | congruent to |
≈ | ≈ | ≈ | almost equal |
≠ | ≠ | ≠ | not equal |
≡ | ≡ | ≡ | equivalent |
≤ | ≤ | ≤ | less or equal |
≥ | ≥ | ≥ | greater or equal |
⊂ | ⊂ | ⊂ | subset of |
⊃ | ⊃ | ⊃ | superset of |
⊄ | ⊄ | ⊄ | not subset of |
⊆ | ⊆ | ⊆ | subset or equal |
⊇ | ⊇ | ⊇ | superset or equal |
⊕ | ⊕ | ⊕ | circled plus |
⊗ | ⊗ | ⊗ | circled times |
⊥ | ⊥ | ⊥ | perpendicular |
⋅ | ⋅ | ⋅ | dot operator |
Α | Α | Α | Alpha |
Β | Β | Β | Beta |
Γ | Γ | Γ | Gamma |
Δ | Δ | Δ | Delta |
Ε | Ε | Ε | Epsilon |
Ζ | Ζ | Ζ | Zeta |
Η | Η | Η | Eta |
Θ | Θ | Θ | Theta |
Ι | Ι | Ι | Iota |
Κ | Κ | Κ | Kappa |
Λ | Λ | Λ | Lambda |
Μ | Μ | Μ | Mu |
Ν | Ν | Ν | Nu |
Ξ | Ξ | Ξ | Xi |
Ο | Ο | Ο | Omicron |
Π | Π | Π | Pi |
Ρ | Ρ | Ρ | Rho |
Σ | Σ | Σ | Sigma |
Τ | Τ | Τ | Tau |
Υ | Υ | Υ | Upsilon |
Φ | Φ | Φ | Phi |
Χ | Χ | Χ | Chi |
Ψ | Ψ | Ψ | Psi |
Ω | Ω | Ω | Omega |
α | α | α | alpha |
β | β | β | beta |
γ | γ | γ | gamma |
δ | δ | δ | delta |
ε | ε | ε | epsilon |
ζ | ζ | ζ | zeta |
η | η | η | eta |
θ | θ | θ | theta |
ι | ι | ι | iota |
κ | κ | κ | kappa |
λ | λ | λ | lambda |
μ | μ | μ | mu |
ν | ν | ν | nu |
ξ | ξ | ξ | xi |
ο | ο | ο | omicron |
π | π | π | pi |
ρ | ρ | ρ | rho |
ς | ς | ς | sigmaf |
σ | σ | σ | sigma |
τ | τ | τ | tau |
υ | υ | υ | upsilon |
φ | φ | φ | phi |
χ | χ | χ | chi |
ψ | ψ | ψ | psi |
ω | ω | ω | omega |
ϑ | ϑ | ϑ | theta symbol |
ϒ | ϒ | ϒ | upsilon symbol |
ϖ | ϖ | ϖ | pi symbol |
Œ | Œ | Œ | capital ligature OE |
œ | œ | œ | small ligature oe |
Š | Š | Š | capital S with caron |
š | š | š | small S with caron |
Ÿ | Ÿ | Ÿ | capital Y with diaeres |
ƒ | ƒ | ƒ | f with hook |
ˆ | ˆ | ˆ | modifier letter circumflex accent |
˜ | ˜ | ˜ | small tilde |
  | en space | ||
  | em space | ||
  | thin space | ||
| | ‌ | zero width non-joiner |
| | ‍ | zero width joiner |
| | ‎ | left-to-right mark |
| | ‏ | right-to-left mark |
– | – | – | en dash |
— | — | — | em dash |
‘ | ‘ | ‘ | left single quotation mark |
’ | ’ | ’ | right single quotation mark |
‚ | ‚ | ‚ | single low-9 quotation mark |
“ | “ | “ | left double quotation mark |
” | ” | ” | right double quotation mark |
„ | „ | „ | double low-9 quotation mark |
† | † | † | dagger |
‡ | ‡ | ‡ | double dagger |
• | • | • | bullet |
… | … | … | horizontal ellipsis |
‰ | ‰ | ‰ | per mille |
′ | ′ | ′ | minutes |
″ | ″ | ″ | seconds |
‹ | ‹ | ‹ | single left angle quotation |
› | › | › | single right angle quotation |
‾ | ‾ | ‾ | overline |
€ | € | € | euro |
™ or � | ™ or ™ | ™ | trademark |
← | ← | ← | left arrow |
↑ | ↑ | ↑ | up arrow |
→ | → | → | right arrow |
↓ | ↓ | ↓ | down arrow |
↔ | ↔ | ↔ | left right arrow |
↵ | ↵ | ↵ | carriage return arrow |
⌈ | ⌈ | ⌈ | left ceiling |
⌉ | ⌉ | ⌉ | right ceiling |
⌊ | ⌊ | ⌊ | left floor |
⌋ | ⌋ | ⌋ | right floor |
◊ | ◊ | ◊ | lozenge |
♠ | ♠ | ♠ | spade |
♣ | ♣ | ♣ | club |
♥ | ♥ | ♥ | heart |
♦ | ♦ | ♦ | diamond |
用python处理html代码的转义与还原 #x27; amp; lt; gt; quot; #x27;等特殊字符相关推荐
- python转义html字符串,用python处理html代码的转义与复原
抓网页数据经常遇到例如>或者 这种HTML转义符,抓到字符串里很是烦人. 比方说一个从网页中抓到的字符串 html = '<abc>' 用Python可以这样处理: importHT ...
- python正则 re模块 字符串转义
python正则表达式转义注意事项 无论哪种语言,在使用正则表达式的时候都避免不了一个问题,就是在匹配元字符的时候,需要对元字符进行转义,让 正则表达式引擎将其当做普通字符来匹配.本文主要以pytho ...
- python 常忘代码查询 和autohotkey补括号脚本
autohotkey更新2018-08-03,9点01 python ;把大写禁用了,因为确实基本不用.`表示删除,caplock+ijkl可以控制光标 SetCapsLockState , Alwa ...
- 关于HTML代码的转义
笔记: 1.在通过jsonp方式传输HTML代码的时候,为了防止代码中的一些字符影响json的语法,需要对HTML代码进行转义. 2.转义的时候可以只转义特殊字符(引号之类的),也可以把所有字符(中文 ...
- Python写的代码打包成.exe可执行文件
Python写的代码打包成.exe可执行文件 1. 安装pyinstaller 2. [在线生成icon](http://www.ico51.cn/) 3. 打包命令 pyinstaller -i x ...
- python浪漫表白代码
python浪漫表白代码 示例代码: import turtle import random# 在(x, y)处画爱心lalala def love(x, y):lv = turtle.Turtle( ...
- Python外壳:代码结构!(IF WHILE FOR RANGE...)
#:octothorpe 书中说它是八脚怪物!哈哈! 注释就要在前面加上一个#符号! 在print语句里,恢复正常的符号功能! \连接符号: 这个样子就不会一行输入很多的东西,读起来不舒服!功能也是一 ...
- 如何学习Python开源项目代码
2019独角兽企业重金招聘Python工程师标准>>> 阅读Python开源项目代码主要有如下三个原因: 1. 在工作过程中遇到一些问题,Google和StackOverFlow等网 ...
- 编程语言介绍、python解释器执行代码的过程
内容大纲 1.编程语言介绍 (*****) 2.Python解释器 (****) 3.执行Python程序的两种方式(****) 4.变量 (*****) 一.编程语言介绍 (*****) 计算机语言 ...
最新文章
- mxnet中ndarray*ndarray用来作为掩码进行与运算的用法
- 2.LRU算法实现 [C++]
- en45545防火标准_揭秘:600岁故宫如何防火?
- 服务器集群后产生那些问题
- java 数组正则表达式_java正则表达式实现提取需要的字符并放入数组【ArrayList数组去重复功能】...
- Windows 8 系列(六):BackgroundTask 及其引起无法捕获的Crash
- 内核中的UDP socket流程(3)(4)——sock_create
- Hack, Everything!
- javaweb JAVA JSP员工绩效考核管理系统(员工考核管理系统)员工考勤管理系统人事考勤
- 重装系统都杀不掉的十大病毒
- Java实现List集合去重的5种方式
- STM32 SPI驱动OLED12864原理图和源代码分享
- 企业部署信息安全等级保护的重要性
- 解决fullpage滑动,控制台的报错提示
- 大型3d射击类游戏源码【突击风暴】,中文版本,可私服
- 从网易云音乐网页版无登陆下载MP3的办法
- 机器学习模型 非线性模型_pycaret在几分钟内准备好您的机器学习模型
- 搜狗输入法中文状态下开启和关闭英文自动提示
- 基于UMa和RMa传播模型的5G覆盖性能研究
- 利用留数定理计算傅立叶变换积分
热门文章
- 如何成为一名优秀的网络工程师?
- 大规模LEO星座波束管理调研报告
- 【BZOJ4864】【BeiJing 2017 Wc】神秘物质(Splay)
- 湖南张家界旅游景区项目方案书
- java.lang.IllegalArgumentException: No converter found for return value of type: class com.sail.comm
- 李航《统计学习方法》学习日记【1】
- 一些常见warning的原因和解决方法
- ViewPager简单介绍(三) ViewPager+Fragment+TabLayout
- htcm8 android8,HTC全面屏手机 U11 Plus曝光:6寸+骁龙835,安卓8.0系统
- java aria,ARIA 标签和关系