Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. import re
  2.  
  3. def unescape(text):
  4.     fd = re.findall(r'\&\#\d+\;', text)
  5.     if len(fd) == 0:
  6.         return text
  7.     for n in set(fd):
  8.         fk = re.search(r'\d+', n).group()
  9.         text = text.replace(n, chr(int(fk)))
  10.     return unescape(text)
  11. print(unescape("hello world ä"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement