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
Post a Comment