Printing Unicode strings in a list
Stephen Tucker
stephen_tucker at sil.org
Thu Apr 28 07:32:22 EDT 2022
Hi PythonList Members,
Consider the following log from a run of IDLE:
==================
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
on win32
Type "copyright", "credits" or "license()" for more information.
>>> print (u"\u2551")
║
>>> print ([u"\u2551"])
[u'\u2551']
>>>
==================
Yes, I am still using Python 2.x - I have good reasons for doing so and
will be moving to Python 3.x in due course.
I have the following questions arising from the log:
1. Why does the second print statement not produce [ ║] or ["║"] ?
2. Should the second print statement produce [ ║] or ["║"] ?
3. Given that I want to print a list of Unicode strings so that their
characters are displayed (instead of their Unicode codepoint definitions),
is there a more Pythonic way of doing it than concatenating them into a
single string and printing that?
4. Does Python 3.x exhibit the same behaviour as Python 2.x in this respect?
Thanks in anticipation.
Stephen Tucker.
More information about the Python-list
mailing list