Python String: Remove Unicode Characters From String

In this tutorial, we will introduce how to remove unicode characters from a python string.

Python: Remove Unicode Characters From String

1.Prepare a python string

string_unicode = " Python is easy \u200c to learn. "

In this string, it has contained a unicode characters: \u200c.

2.Remove unicode characters using string..encode()

string_encode = string_unicode.encode("ascii", "ignore")
string_decode = string_encode.decode()
print(string_decode)

Run this code, you will see this python string:

Python is easy to learn.