Strange append to list?


Lesson is easy enough, and my code should be fine, but the output is what I find weird.


hobbies = []

# Add your code below!
for each in range(3):
  hobby = raw_input("What's a hobby to add:")
print hobbies

What's a hobby to add:not
What's a hobby to add:too
What's a hobby to add:much
[u'not', u'too', u'much']

Why is there a u in front of my list entries?


because raw_input stores the entries as unicode type, you can simple cast it to a string:

str(raw_input("What's a hobby to add:"))


and i guess you can deduce that the u is an abbreviation of unicode


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