Python 2.6x
I have the following code:
hobbies = []
# Add your code elow!
for i in range(3):
hobbies.append(raw_input("Enter a value : "))
print hobbies
It's generating the following output, if I enter the values as:
Enter a value : 1
Enter a value : abcd
Enter a value : a giga aks
[u'1', u'abcd', u'a giga aks']
I know that if I wrap str() around raw_input(..) then, print statement on list hobbies will print it successfully i.e. without "u" character in front of every list value.
I tried print str(hobbies) but it's still printing "u" as a prefix for every list value. If raw_input() returns a string type, then it should successfully add the entered values to the list which seems like it did but still printing "u" is something I'm not able to understand why.
Why it's printing "u"?