0

I have a string "hello[ World]" and I want to convert it to "hello[World]"

I tried something like this:

 a.encode("utf-8").decode("ascii")

I got back same string as input.

enter image description here

javaMan
  • 6,352
  • 20
  • 67
  • 94
  • 1
    Sounds like an XY question, are you trying to decode the html coded character set? https://www.w3.org/MarkUp/html-spec/html-spec_13.html – Keatinge May 28 '19 at 21:53
  • Possible duplicate of https://stackoverflow.com/questions/2087370/decode-html-entities-in-python-string – Keatinge May 28 '19 at 21:54

1 Answers1

1

Try this:

import html
html.unescape("LASIX [FUROSEMIDE]")

This produces:

'LASIX [FUROSEMIDE]'
Tom Karzes
  • 22,815
  • 2
  • 22
  • 41