html代码的转义

import html
print(html.escape("""'& < >\"'"""))
&#x27; &amp; &lt; &gt; &quot; '

html代码的转义还原

import html
print(html.unescape("'&amp; &lt; &gt;&quot;'"))
'& < >"'
'
&amp; &
&lt; <
&gt; >
&quot; "
'
字母或有些符号等+ ̀ 例 à
字母或有些符号等+ ́ 例 Á
字母或有些符号等+ ̂例 /̂
字母或有些符号等+ ̃例 \\̃
显示结果 描述 实体名称 实体编号
  &nbsp; 非间断空格(non-breaking space)
¡ ¡ &iexcl; 倒置感叹号(inverted exclamation mark)
¢ ¢ &cent; 美分符号(cent)
£ £ &pound; 英镑符号(pound)
¤ ¤ &curren; 货币符号(currency)
¥ ¥ &yen; 人民币/日元符号(yen)
¦ ¦ &brvbar; 间断的竖杠(broken vertical bar)
§ § &sect; 小节号(section)
¨ ¨ &uml; 分音符号(spacing diaeresis)
© © &copy; 版权所有(copyright)
ª ª &ordf; 阴性序数记号(feminine ordinal indicator)
« « &laquo; 左双角引号(angle quotation mark (left))
¬ ¬ &not; 否定符号(negation)
­ ­ &shy; 软连字符(soft hyphen)
® ® &reg; 注册商标(registered trademark)
¯ ¯ &macr; 长音符号(spacing macron)
° ° &deg; 度符号(degree)
± ± &plusmn; 加减号/正负号(plus-or-minus)
² ² &sup2; 上标 2(superscript 2)
³ ³ &sup3; 上标 3(superscript 3)
´ ´ &acute; 尖音符号(spacing acute)
µ µ &micro; 微米符号(micro)
&para; 段落符号(paragraph)
· · &middot; 中间点(middle dot)
¸ ¸ &cedil; 变音符号(spacing cedilla)
¹ ¹ &sup1; 上标 1(superscript 1)
º º &ordm; 阳性序数记号(masculine ordinal indicator)
» » &raquo; 右双角引号(angle quotation mark (right))
¼ ¼ &frac14; 1/4 分数(fraction 1/4)
½ ½ &frac12; 1/2 分数(fraction 1/2)
¾ ¾ &frac34; 3/4 分数(fraction 3/4)
¿ ¿ &iquest; 倒置问号(inverted question mark)
À À &Agrave; 大写字母 A,重音(grave accent)
Á Á &Aacute; 大写字母 A,尖音(acute accent)
  &Acirc; 大写字母 A,抑扬音(circumflex accent)
à à &Atilde; 大写字母 A,腭化(tilde)
Ä Ä &Auml; 大写字母 A,带有变音符号标记(umlaut mark)
Å Å &Aring; 大写字母 A,带有上圆圈(ring)
Æ Æ &AElig; 大写字母 AE
Ç Ç &Ccedil; 大写字母 C,变音(cedilla)
È È &Egrave; 大写字母 E,重音(grave accent)
É É &Eacute; 大写字母 E,尖音(acute accent)
Ê Ê &Ecirc; 大写字母 E,抑扬音(circumflex accent)
Ë Ë &Euml; 大写字母 E,带有变音符号标记(umlaut mark)
Ì Ì &Igrave; 大写字母 I,重音(grave accent)
Í Í &Iacute; 大写字母 I,尖音(acute accent)
Î Î &Icirc; 大写字母 I,抑扬音(circumflex accent)
Ï Ï &Iuml; 大写字母 I,带有变音符号标记(umlaut mark)
Ð Ð &ETH; 冰岛语大写字母 eth
Ñ Ñ &Ntilde; 大写字母 N,腭化(tilde)
Ò Ò &Ograve; 大写字母 O,重音(grave accent)
Ó Ó &Oacute; 大写字母 O,尖音(acute accent)
Ô Ô &Ocirc; 大写字母 O,抑扬音(circumflex accent)
Õ Õ &Otilde; 大写字母 O,腭化(tilde)
Ö Ö &Ouml; 大写字母 O,带有变音符号标记(umlaut mark)
× × &times; 乘号(multiplication)
Ø Ø &Oslash; 大写字母 O,带有斜线(slash)
Ù Ù &Ugrave; 大写字母 U,重音(grave accent)
Ú Ú &Uacute; 大写字母 U,尖音(acute accent)
Û Û &Ucirc; 大写字母 U,抑扬音(circumflex accent)
Ü Ü &Uuml; 大写字母 U,带有变音符号标记(umlaut mark)
Ý Ý &Yacute; 大写字母 Y,尖音(acute accent)
Þ Þ &THORN; 冰岛语大写字母 THORN
ß ß &szlig; 德语小写字母 sharp s
à à &agrave; 小写字母 a,重音(grave accent)
á á &aacute; 小写字母 a,尖音(acute accent)
â â &acirc; 小写字母 a,抑扬音(circumflex accent)
ã ã &atilde; 小写字母 a,腭化(tilde)
ä ä &auml; 小写字母 a,带有变音符号标记(umlaut mark)
å å &aring; 小写字母 a,带有上圆圈(ring)
æ æ &aelig; 小写字母 ae
ç ç &ccedil; 小写字母 c,变音(cedilla)
è è &egrave; 小写字母 e,重音(grave accent)
é é &eacute; 小写字母 e,尖音(acute accent)
ê ê &ecirc; 小写字母 e,抑扬音(circumflex accent)
ë ë &euml; 小写字母 e,带有变音符号标记(umlaut mark)
ì ì &igrave; 小写字母 i,重音(grave accent)
í í &iacute; 小写字母 i,尖音(acute accent)
î î &icirc; 小写字母 i,抑扬音(circumflex accent)
ï ï &iuml; 小写字母 i,带有变音符号标记(umlaut mark)
ð ð &eth; 冰岛语小写字母 eth
ñ ñ &ntilde; 小写字母 n,腭化(tilde)
ò ò &ograve; 小写字母 o,重音(grave accent)
ó ó &oacute; 小写字母 o,尖音(acute accent)
ô ô &ocirc; 小写字母 o,抑扬音(circumflex accent)
õ õ &otilde; 小写字母 o,腭化(tilde)
ö ö &ouml; 小写字母 o,带有变音符号标记(umlaut mark)
÷ ÷ &divide; 除号(division)
ø ø &oslash; 小写字母 o,带有斜线(slash)
ù ù &ugrave; 小写字母 u,重音(grave accent)
ú ú &uacute; 小写字母 u,尖音(acute accent)
û û &ucirc; 小写字母 u,抑扬音(circumflex accent)
ü ü &uuml; 小写字母 u,带有变音符号标记(umlaut mark)
ý ý &yacute; 小写字母 y,尖音(acute accent)
þ þ &thorn; 冰岛语小写字母 thorn
ÿ ÿ &yuml; 小写字母 y,带有变音符号标记(umlaut mark)
&forall; for all
&part; part
&exist; exists
&empty; empty
&nabla; nabla
&isin; isin
&notin; notin
&ni; ni
&prod; prod
&sum; sum
&minus; minus
&lowast; lowast
&radic; square root
&prop; proportional to
&infin; infinity
&ang; angle
&and; and
&or; or
&cap; cap
&cup; cup
&int; integral
&there4; therefore
&sim; similar to
&cong; congruent to
&asymp; almost equal
&ne; not equal
&equiv; equivalent
&le; less or equal
&ge; greater or equal
&sub; subset of
&sup; superset of
&nsub; not subset of
&sube; subset or equal
&supe; superset or equal
&oplus; circled plus
&otimes; circled times
&perp; perpendicular
&sdot; dot operator
Α Α &Alpha; Alpha
Β Β &Beta; Beta
Γ Γ &Gamma; Gamma
Δ Δ &Delta; Delta
Ε Ε &Epsilon; Epsilon
Ζ Ζ &Zeta; Zeta
Η Η &Eta; Eta
Θ Θ &Theta; Theta
Ι Ι &Iota; Iota
Κ Κ &Kappa; Kappa
Λ Λ &Lambda; Lambda
Μ Μ &Mu; Mu
Ν Ν &Nu; Nu
Ξ Ξ &Xi; Xi
Ο Ο &Omicron; Omicron
Π Π &Pi; Pi
Ρ Ρ &Rho; Rho
Σ Σ &Sigma; Sigma
Τ Τ &Tau; Tau
Υ Υ &Upsilon; Upsilon
Φ Φ &Phi; Phi
Χ Χ &Chi; Chi
Ψ Ψ &Psi; Psi
Ω Ω &Omega; Omega
α α &alpha; alpha
β β &beta; beta
γ γ &gamma; gamma
δ δ &delta; delta
ε ε &epsilon; epsilon
ζ ζ &zeta; zeta
η η &eta; eta
θ θ &theta; theta
ι ι &iota; iota
κ κ &kappa; kappa
λ λ &lambda; lambda
μ μ &mu; mu
ν ν &nu; nu
ξ ξ &xi; xi
ο ο &omicron; omicron
π π &pi; pi
ρ ρ &rho; rho
ς ς &sigmaf; sigmaf
σ σ &sigma; sigma
τ τ &tau; tau
υ υ &upsilon; upsilon
φ φ &phi; phi
χ χ &chi; chi
ψ ψ &psi; psi
ω ω &omega; omega
ϑ ϑ &thetasym; theta symbol
ϒ ϒ &upsih; upsilon symbol
ϖ ϖ &piv; pi symbol
ΠΠ&OElig; capital ligature OE
œ œ &oelig; small ligature oe
Š Š &Scaron; capital S with caron
š š &scaron; small S with caron
Ÿ Ÿ &Yuml; capital Y with diaeres
ƒ ƒ &fnof; f with hook
ˆ ˆ &circ; modifier letter circumflex accent
˜ ˜ &tilde; small tilde
&ensp; en space
&emsp; em space
&thinsp; thin space
&zwnj; zero width non-joiner
&zwj; zero width joiner
&lrm; left-to-right mark
&rlm; right-to-left mark
&ndash; en dash
&mdash; em dash
&lsquo; left single quotation mark
&rsquo; right single quotation mark
&sbquo; single low-9 quotation mark
&ldquo; left double quotation mark
&rdquo; right double quotation mark
&bdquo; double low-9 quotation mark
&dagger; dagger
&Dagger; double dagger
&bull; bullet
&hellip; horizontal ellipsis
&permil; per mille
&prime; minutes
&Prime; seconds
&lsaquo; single left angle quotation
&rsaquo; single right angle quotation
&oline; overline
&euro; euro
™ or � ™ or ™ &trade; trademark
&larr; left arrow
&uarr; up arrow
&rarr; right arrow
&darr; down arrow
&harr; left right arrow
&crarr; carriage return arrow
&lceil; left ceiling
&rceil; right ceiling
&lfloor; left floor
&rfloor; right floor
&loz; lozenge
&spades; spade
&clubs; club
&hearts; heart
&diams; diamond

用python处理html代码的转义与还原 #x27; amp; lt; gt; quot; #x27;等特殊字符相关推荐

  1. python转义html字符串,用python处理html代码的转义与复原

    抓网页数据经常遇到例如>或者 这种HTML转义符,抓到字符串里很是烦人. 比方说一个从网页中抓到的字符串 html = '<abc>' 用Python可以这样处理: importHT ...

  2. python正则 re模块 字符串转义

    python正则表达式转义注意事项 无论哪种语言,在使用正则表达式的时候都避免不了一个问题,就是在匹配元字符的时候,需要对元字符进行转义,让 正则表达式引擎将其当做普通字符来匹配.本文主要以pytho ...

  3. python 常忘代码查询 和autohotkey补括号脚本

    autohotkey更新2018-08-03,9点01 python ;把大写禁用了,因为确实基本不用.`表示删除,caplock+ijkl可以控制光标 SetCapsLockState , Alwa ...

  4. 关于HTML代码的转义

    笔记: 1.在通过jsonp方式传输HTML代码的时候,为了防止代码中的一些字符影响json的语法,需要对HTML代码进行转义. 2.转义的时候可以只转义特殊字符(引号之类的),也可以把所有字符(中文 ...

  5. Python写的代码打包成.exe可执行文件

    Python写的代码打包成.exe可执行文件 1. 安装pyinstaller 2. [在线生成icon](http://www.ico51.cn/) 3. 打包命令 pyinstaller -i x ...

  6. python浪漫表白代码

    python浪漫表白代码 示例代码: import turtle import random# 在(x, y)处画爱心lalala def love(x, y):lv = turtle.Turtle( ...

  7. Python外壳:代码结构!(IF WHILE FOR RANGE...)

    #:octothorpe 书中说它是八脚怪物!哈哈! 注释就要在前面加上一个#符号! 在print语句里,恢复正常的符号功能! \连接符号: 这个样子就不会一行输入很多的东西,读起来不舒服!功能也是一 ...

  8. 如何学习Python开源项目代码

    2019独角兽企业重金招聘Python工程师标准>>> 阅读Python开源项目代码主要有如下三个原因: 1. 在工作过程中遇到一些问题,Google和StackOverFlow等网 ...

  9. 编程语言介绍、python解释器执行代码的过程

    内容大纲 1.编程语言介绍 (*****) 2.Python解释器 (****) 3.执行Python程序的两种方式(****) 4.变量 (*****) 一.编程语言介绍 (*****) 计算机语言 ...

最新文章

  1. mxnet中ndarray*ndarray用来作为掩码进行与运算的用法
  2. 2.LRU算法实现 [C++]
  3. en45545防火标准_揭秘:600岁故宫如何防火?
  4. 服务器集群后产生那些问题
  5. java 数组正则表达式_java正则表达式实现提取需要的字符并放入数组【ArrayList数组去重复功能】...
  6. Windows 8 系列(六):BackgroundTask 及其引起无法捕获的Crash
  7. 内核中的UDP socket流程(3)(4)——sock_create
  8. Hack, Everything!
  9. javaweb JAVA JSP员工绩效考核管理系统(员工考核管理系统)员工考勤管理系统人事考勤
  10. 重装系统都杀不掉的十大病毒
  11. Java实现List集合去重的5种方式
  12. STM32 SPI驱动OLED12864原理图和源代码分享
  13. 企业部署信息安全等级保护的重要性
  14. 解决fullpage滑动,控制台的报错提示
  15. 大型3d射击类游戏源码【突击风暴】,中文版本,可私服
  16. 从网易云音乐网页版无登陆下载MP3的办法
  17. 机器学习模型 非线性模型_pycaret在几分钟内准备好您的机器学习模型
  18. 搜狗输入法中文状态下开启和关闭英文自动提示
  19. 基于UMa和RMa传播模型的5G覆盖性能研究
  20. 利用留数定理计算傅立叶变换积分

热门文章

  1. 如何成为一名优秀的网络工程师?
  2. 大规模LEO星座波束管理调研报告
  3. 【BZOJ4864】【BeiJing 2017 Wc】神秘物质(Splay)
  4. 湖南张家界旅游景区项目方案书
  5. java.lang.IllegalArgumentException: No converter found for return value of type: class com.sail.comm
  6. 李航《统计学习方法》学习日记【1】
  7. 一些常见warning的原因和解决方法
  8. ViewPager简单介绍(三) ViewPager+Fragment+TabLayout
  9. htcm8 android8,HTC全面屏手机 U11 Plus曝光:6寸+骁龙835,安卓8.0系统
  10. java aria,ARIA 标签和关系