Censor (Unicode Decode Error)




The code gives me the following error "Traceback (most recent call last):
File "python", line 12, in
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 19: ordinal not in range(128)" and I can not figure it out after searching for the possible erors for one hour.

I would appreciate your help.
Thanks in advance!

text="naber olum manyak mısın olum"
def censor(text, word):
    splitted = text.split()
    for i in range(len(splitted)):
        if splitted[i] == word:
            ben.append(len(word)* "*")
    return " ".join(ben)
print censor(text, word)


Make sure you're using plain Latin characters. Some Unicode characters are not accepted.


Ohhhh, thank you SO much, I didn't notice that!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.