Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Take an astronaut to launch.


devel / comp.lang.python / Re: Printing Unicode strings in a list

SubjectAuthor
o Re: Printing Unicode strings in a listVlastimil Brom

1
Re: Printing Unicode strings in a list

<mailman.275.1651327357.20749.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18083&group=comp.lang.python#18083

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: vlastimi...@gmail.com (Vlastimil Brom)
Newsgroups: comp.lang.python
Subject: Re: Printing Unicode strings in a list
Date: Sat, 30 Apr 2022 16:02:22 +0200
Lines: 79
Message-ID: <mailman.275.1651327357.20749.python-list@python.org>
References: <CAP=-cKXWHH8f+479sn5c=KzYV=_gEu+9UZ+kFk5at-KiDFjQJA@mail.gmail.com>
<CAHzaPENY_CA53wuc2wW0MWivwb9Xu0V2BTSSf=-LcXAdsy2PRA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de ulgn7kVlZBlLNrgtlDeV5gEfhmZ95FjUCm9rAxBX+CAg==
Return-Path: <vlastimil.brom@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=M2lu0/0U;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '2022': 0.05; 'skip:= 10':
0.05; 'members,': 0.07; 'string': 0.07; 'that?': 0.07;
'apparently': 0.09; 'log:': 0.09; 'subject:Unicode': 0.09;
'subject:list': 0.11; 'log': 0.12; 'url:mailman': 0.15; '(even':
0.16; '(instead': 0.16; '(it': 0.16; '3.x': 0.16; 'behaviour':
0.16; 'cases,': 0.16; 'displayed': 0.16; 'prefix': 0.16;
'python3': 0.16; 'pythonic': 0.16; 'redundant': 0.16; 'respect?':
0.16; 'unicode': 0.16; 'python': 0.16; 'instead': 0.17; 'to:addr
:python-list': 0.20; 'maybe': 0.22; 'run': 0.23; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25; 'bit': 0.27;
'>>>': 0.28; 'printed': 0.28; 'received:209.85.210': 0.29; 'url-
ip:188/8': 0.31; 'question': 0.32; 'answers': 0.32; 'course.':
0.32; 'to:name:python': 0.32; 'message-id:@mail.gmail.com': 0.32;
"i'm": 0.33; 'there': 0.33; 'focus': 0.33; 'same': 0.34;
'printing': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'yes,': 0.35; 'following': 0.35;
'from:addr:gmail.com': 0.35; 'using': 0.37; 'received:209.85':
0.37; 'way': 0.38; 'thanks': 0.38; 'received:209': 0.39; 'single':
0.39; 'list': 0.39; 'still': 0.40; 'want': 0.40; 'should': 0.40;
'sample': 0.61; 'clear': 0.64; 'your': 0.64; 'produce': 0.65;
'arising': 0.67; '2015,': 0.69; 'reasons': 0.84; 'characters':
0.84; 'exhibit': 0.84; 'quotation': 0.84; 'strings': 0.84; '4th':
0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:content-transfer-encoding;
bh=nOp5k1Xbo/4vgLAL3yt1Dhsz8/XYieH9vQ2+XsqvhNE=;
b=M2lu0/0U1TNSlEvejq/l80GOnMFnrzOSA/sa7BAry31eIeicR0wJZJRDqJVbvQkj7i
t6RCow7Jo++EYH60baLtBj6Zak2wnkJg+81zLmNPUFgUWcGM38/1qQXqnAk8Bif29wJj
HV6SZDNSQbpFTuyXijyR97ArZsFsTv21LImjHw/hcBqtCsHn8s5CNWx6wEaUdB+1Ks6H
hMtoY0lTn8XdH03miEVR40cscoeh4Fk2UZ5E+l8f45bKsUErWLZtu1N5k+/YiE2VFwNl
eKdHwIbHu6ow2eMCSUIzmf6QZgwnEgVTlAWfWGD9RE7ZukcXgyChhjpmI6Gg1zBMY07d
qNew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:content-transfer-encoding;
bh=nOp5k1Xbo/4vgLAL3yt1Dhsz8/XYieH9vQ2+XsqvhNE=;
b=je5tpSq+8RDGL2VEJ4hwBZ53Q89GAnWGIdywqqU0Xdmelsr3Y/kFGNYmA1qS8TvwF/
rzoZhEBHARocbuxW5Yhjm+64N7L6m382OvmyaHABrtRNJbAZgSZ0I0JteA9jeQhi2Gc5
s00YWj0dcwhE2KDpJlYo+c/xamT/bWwDG0hNvR+dCf7qvQMDFU894hpIXuYaXUmvIBP0
cTce/alr4xLLUfeybZEc8bs5Fd7SJ5Qb6Ps6AgYeERI0AJViBVoRe1RYiaHtW65gItEQ
1u+1USWSX9k7gigohxsnmhe0DHg9V9e1h2mw1oxF/X20YLWgF9GQ7gOvm/hMD8v1UhYq
eMHw==
X-Gm-Message-State: AOAM532JJah0TdyDTm4l5EFAWizH2FyfB2QR5pNDHb5DEp2NJ82cGXJS
/wuQka3xO1+T63UmFJbqs4KxXCXxD/r/h37ik9p/2qHgaMI=
X-Google-Smtp-Source: ABdhPJzqjWTlJrTCjcYGFy0VyeNJA8KPfvQAbL1IKLV5ETp3ECs5mURi8xjYwnYojfwsNJbd+yMm57V+N6dlvuX6fpU=
X-Received: by 2002:a05:6a00:16c7:b0:4f7:e497:69c7 with SMTP id
l7-20020a056a0016c700b004f7e49769c7mr3810628pfc.7.1651327354854; Sat, 30 Apr
2022 07:02:34 -0700 (PDT)
In-Reply-To: <CAP=-cKXWHH8f+479sn5c=KzYV=_gEu+9UZ+kFk5at-KiDFjQJA@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAHzaPENY_CA53wuc2wW0MWivwb9Xu0V2BTSSf=-LcXAdsy2PRA@mail.gmail.com>
X-Mailman-Original-References: <CAP=-cKXWHH8f+479sn5c=KzYV=_gEu+9UZ+kFk5at-KiDFjQJA@mail.gmail.com>
 by: Vlastimil Brom - Sat, 30 Apr 2022 14:02 UTC

čt 28. 4. 2022 v 13:33 odesílatel Stephen Tucker
<stephen_tucker@sil.org> napsal:
>
> 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.
> --
> https://mail.python.org/mailman/listinfo/python-list

Hi,
I'm not sure, whether I am not misunderstanding the 4th question or
the answers to it (it is not clear to me, whether the focus is on
character printing or the quotation marks...);
in either case, in python3 the character glyphs are printed in these
cases, instead of the codepoint number notation, cf.:
=================Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (
AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print ([u"\u2551"])
['║']
>>>
>>> print([u"\u2551"])
['║']
>>> print("\u2551")

>>> print("║")

>>> print(repr("\u2551"))
'║'
>>> print(ascii("\u2551"))
'\u2551'
>>>
=================
(Even the redundant u prefix from your python2 sample is apparently
accepted, maybe for compatibility reasons.)

hth,
vbr

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor