Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5992
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | c.buhtz@posteo.jp |
| Newsgroups | de.comp.lang.python |
| Subject | [Python-de] Muss ich % immer escapen? |
| Date | Wed, 21 Jun 2023 18:29:46 +0000 |
| Lines | 31 |
| Message-ID | <f0307b1643db4b81edba11cc449a7d25@posteo.de> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de M3nABYpfSME2KuKmq61TlAnHgeSPUz3uLvjNRmNwyoyQ== |
| Authentication-Results | mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=posteo.jp header.i=@posteo.jp header.b=aot8s/pO; dkim-adsp=pass; dkim-atps=neutral |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.jp; s=2017; t=1687372186; bh=ABCDfEvsMPVn3C5Z8kk9jETZOe34dsFq8HRiR9MfHPA=; h=MIME-Version:Content-Transfer-Encoding:Date:From:To:Subject: Message-ID:From; b=aot8s/pOA71Zpy5wGu9YSgsanzRRlhaclUlep09wB3TMLj91oA5YJNPLTlQf8bnzk NkKPcAu3D4ijW5fD1dlSEUj7g92THsf4M309iu5Y2nwfYnObZPOe2wg3lJ91s5ZfDk J6ju38PNlx9GiHNYh4zGScEU4GaGRDEvLC3hZt5KxB2BNpHK+w0ZGI9sBIxy9KMLPF db26Fk+RRl+FIPZGdCUPNl+9QQLfuAr3B0xOuJKClgnn9/fIR89BMbG7ZEVJEArlb2 tcgOdSWcJKHcvdwO6/pio6qbPL93ZTQtRxXa6PlFlu3p9wSu8gt2CPCY7gVaZpIkAb topqsQmeOXzbA== |
| Message-ID-Hash | CRONBQTGHC43PUD56W66CGI32GUFKVKA |
| X-Message-ID-Hash | CRONBQTGHC43PUD56W66CGI32GUFKVKA |
| X-MailFrom | c.buhtz@posteo.jp |
| X-Mailman-Rule-Misses | dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-python-de.python.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header |
| X-Mailman-Version | 3.3.9b1 |
| Precedence | list |
| List-Id | Die Deutsche Python Mailingliste <python-de.python.org> |
| Archived-At | <https://mail.python.org/archives/list/python-de@python.org/message/CRONBQTGHC43PUD56W66CGI32GUFKVKA/> |
| List-Archive | <https://mail.python.org/archives/list/python-de@python.org/> |
| List-Help | <mailto:python-de-request@python.org?subject=help> |
| List-Owner | <mailto:python-de-owner@python.org> |
| List-Post | <mailto:python-de@python.org> |
| List-Subscribe | <mailto:python-de-join@python.org> |
| List-Unsubscribe | <mailto:python-de-leave@python.org> |
| Xref | csiph.com de.comp.lang.python:5992 |
Show key headers only | View raw
Hallo,
ein Beispiel zum Einstieg.
val = '15'
print('Trying to keep min {perc}% free inodes'.format(perc=val))
Ist das korrektes valides PEP konformes Python? Meine Linter
(pycodestyle und ruff) sind zufrieden.
Alternative (und etwas ältere) Schreibweise wäre noch:
val = '15'
print('Trying to keep min %(perc)f%% free inodes'.format(perc=val))
print('Trying to keep min f%% free inodes'.format(val))
Der Punkt beim letzen Codeblock ist, dass das %-Zeichen ganz klar
escaped werden muss.
Beim ersten Codeblock scheint das nicht notwendig zu sein. Unabhängig
davon, was die Linter und der Python-Interpreter dazu sagen, ist meine
Frage, ob das formal korrekt ist. Oder muss ich eigentlich auch im
ersten Beispiel das % escapen, wenn ich es pedantisch richtig mache
möchte?
In PEP3101 kann ich zum % Zeichen nichts finden. Dort wird nur
beschrieben, wie man geschweifte Klammern escaped.
https://peps.python.org/pep-3101/
Christian
Back to de.comp.lang.python | Previous | Next — Next in thread | Find similar
[Python-de] Muss ich % immer escapen? c.buhtz@posteo.jp - 2023-06-21 18:29 +0000
Re: [Python-de] Muss ich % immer escapen? "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2023-06-22 14:03 +0200
[Python-de] Re: Muss ich % immer escapen? c.buhtz@posteo.jp - 2023-06-22 12:52 +0000
Re: [Python-de] Re: Muss ich % immer escapen? "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2023-06-22 15:58 +0200
[Python-de] Re: Muss ich % immer escapen? c.buhtz@posteo.jp - 2023-06-22 14:14 +0000
Re: [Python-de] Re: Muss ich % immer escapen? "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2023-06-22 18:27 +0200
[Python-de] Re: Muss ich % immer escapen? Henning Reich <info@qupfer.de> - 2023-06-22 15:20 +0200
csiph-web