The 'in' Operator Error


#1



https://www.codecademy.com/courses/python-beginner-en-KAgt5/0/3?curriculum_id=4f89dab3d788890003000096#


Traceback (most recent call last):
File "python", line 10, in
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128)


What happened?


my_dict = {
    'Turtles': 'Shell',
    'Bacon': 'Yum',
    'idontknowwhattoputinhereso': '¯\_(ツ)_/¯'
}
print my_dict.keys()
print my_dict.values()

for key in my_dict:
    print key, my_dict[key]


#2

Try without the silly code!

The part I am referring to is this: '¯_(ツ)_/¯'


#3

Oh, thanks. that really helped (I knew i shouldn't have done that)


#4

There are work-arounds but the best one, if available, is to simply upgrade the involved tools, including python


#5

Yeah, I got the idea when the error said about 'ascii'.

To my knowledge, ascii means the characters that you use on your computer. And I saw that you used some weird ones - so now you know.


#6

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