For your hobbies


my results seem odd: instead of getting a clean element in the list, I get the letter U in front of each element:



its the u of unicode:


Thank you. that clarifies this…
but it was not showing like this earlier…
is there some config or parameter I may have changed by mistake?
can I / should I change this back?


result from raw_input is encoded as unicode:

print type(raw_input('enter something: '))

type() is a function which tells us data type.

the u of unicode only shows when you print the whole list, not each individual item. If you really want to get rid of it, you can always convert to string, but there is nothing wrong with using unicode


Thank you very much for explaining:grinning:


Forget you saw it. You probably don’t want to understand it yet and even then we’re talking about something not relevant and from a bad perspective.

Python2 didn’t distinguish very well between text and raw data, they shared the same type. In python3 they are separate types, and whenever talking to the outside world (files, network, printing, reading) you gotta convert between this data and text. Mostly this is done by python so that you appear to read and write text, not zeros and ones.


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