Guest User

Untitled

a guest
Aug 25th, 2019
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 ä"))
RAW Paste Data