khadiza192 / encode-string-methods-use Goto Github PK
View Code? Open in Web Editor NEW# encode #use of incode strings methods in python 3 txt = "My name is Khådiza" print(txt.encode(encoding="ascii",errors="backslashreplace")) print(txt.encode(encoding="ascii",errors="ignore")) print(txt.encode(encoding="ascii",errors="namereplace")) print(txt.encode(encoding="ascii",errors="replace")) print(txt.encode(encoding="ascii",errors="xmlcharrefreplace")) print(txt.encode(encoding="ascii",errors="strict"))