The expression (u'1S²')
is not a tuple
, it's a unicode
value. A 1-tuple is written in Python this way: (u'1S²',)
.
The print value
statement prints a str(value)
in fact. If you need to output several unicode
strings, you should use something like this:
print u' '.join((u'1S²',u'2S¹'))
Though there might be issues with character encodings. If you know your console encoding, you may encode your unicode
values to str
manually:
ENCODING = 'utf-8'
print u' '.join((u'1S²',u'2S¹')).encode(ENCODING)
The number of iterms in tuples, lists, strings and other sequences can be obtained using len
function.