Python: getting rid of the ‘u’ symbol when outputting text

I find it really annoying that whenever Python prints a string it prints out a u¬†when it’s Unicode.

When you copy and paste that stuff it retains it all. If you’re copying and pasting JSON you’re left with broken JSON. Here’s how to get rid of it:

data = json.dumps(d, ensure_ascii=False).decode('utf8')
print data


Leave a Reply

Your email address will not be published. Required fields are marked *