# How can I create a Python tuple of Unicode strings?

PythonProgramming

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

You can create a tuple of unicode strings in python using the u'' syntax when defining this tuple.

## example

a = [(u'亀',), (u'犬',)]
print(a)

## Output

This will give the output

[('亀',), ('犬',)]

Note that you have to provide the u if you want to say that this is a unicode string. Else it will be treated as a normal binary string. And you'll get an unexpected output.

## example

a = [('亀',), ('犬',)]
print(a)

## Output

This will give the output

[('\xe4\xba\x80',), ('\xe7\x8a\xac',)]
Updated on 05-Mar-2020 06:06:15