How do I convert characters like ":" to ":" in python? -


possible duplicate:
convert xml/html entities unicode string in python

in html sources, there tons of chars "&# 58;" or "&# 46;" (have put space between &# , numbers or these chars considered ":" or "."), questions is, how convert them supposed in python? there built in method or something?

hopefully can me out. thanks

i not sure there built-in library or not, here quick , dirty way regex

>>> import re >>> re.sub("&#(\d+);",lambda x:unichr(int(x.group(1),10)),": or .") u': or .' 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -