[Answer]-List as value of session variable in Django

1👍

The u at the beginning of the string returned to your view function just means that the strings are encoded in unicode. You need not handle it specially in your code. Accessing the list just normally will return you the expected strings.

This is what I mean:

>>> a = [u'a',u'b']
>>> b = [u'c',u'd']
>>> a[1]
'b'
>>> b[0]
'c'

As evident from the output, when you access the elements, you do not see the ‘u’ as part of the strings.

Hope this helps.

Leave a comment