Q:

Need help with tuples in python

When I print the tuple (u'1S²') I get the predicted output of 1S² 
However, when I print the tuple (u'1S²',u'2S¹') I get the output (u'1S\xb2', u'2S\xb9').
Why is this? What can I do about this?
Also, how do I get the number of items in a tuple? 

A:

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.

