From: Ralph Corderoy <ralph@inputplus.co.uk>
To: coff@tuhs.org
Subject: [COFF] fmt Strings. (Was: A few comments on porting the Bourne shell)
Date: Sat, 31 Dec 2022 11:57:19 +0000 [thread overview]
Message-ID: <20221231115719.B97EE21FB4@orac.inputplus.co.uk> (raw)
In-Reply-To: <20221231044049.GI5825@mcvoy.com>
Hi Larry,
> I hate Python because there is no printf in the base language.
There's print() with the format-string part being promoted into the
language as the ‘%’ operator when the left operand is a string.
It returns a string.
>>> '%10d' % (6*7)
' 42'
>>> '%s %s!\n' % ('hello', 'world')
'hello world!\n'
>>> '%10d' % 6*7
' 6 6 6 6 6 6 6'
>>> print('foo')
foo
>>> print('%.3s' % 'barxyzzy')
bar
>>>
So similar to AWK or Perl's sprintf() and Go's fmt.Sprintf() in that it
returns a dynamically-allocated string.
--
Cheers, Ralph.
next parent reply other threads:[~2022-12-31 11:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <52FB6638-AEFF-4A4F-8C2E-32089D577BA0@planet.nl>
[not found] ` <464819f0-d2f6-2a60-6481-a194f4428b4d@case.edu>
[not found] ` <20221230200246.GW5825@mcvoy.com>
[not found] ` <88f83b4c-b3f9-ed87-b2fa-560fb369742a@makerlisp.com>
[not found] ` <20221231035931.GG5825@mcvoy.com>
[not found] ` <BD716565-29A2-4959-AA20-339E91DBF789@iitbombay.org>
[not found] ` <20221231044049.GI5825@mcvoy.com>
2022-12-31 11:57 ` Ralph Corderoy [this message]
[not found] ` <alpine.BSF.2.21.9999.2212311516330.69068@aneurin.horsfall.org>
[not found] ` <528f0c53-ccc2-88a1-5a7b-120362c648dd@mhorton.net>
[not found] ` <CAC20D2NZbBa9PK_F50iWVn+t7m8=_mcw4mR2mKcTgDbdqxJi=w@mail.gmail.com>
[not found] ` <20230102165120.GK25547@mcvoy.com>
[not found] ` <E977D385-604F-49A9-83FD-8C5270623066@gmail.com>
[not found] ` <20230102174304.GM25547@mcvoy.com>
[not found] ` <E4339ED1-73F4-4BBB-92EF-B9D5A92C5096@gmail.com>
[not found] ` <CAC20D2Pf-rLL8NqoJ7RcXHjrq4crQKC=K25218fuM0yd0rQNDA@mail.gmail.com>
[not found] ` <CAEoi9W7A==NC+W+H+kZbUZ6AK2O-cUjwjUz_Gx_HY_BKfeeBqA@mail.gmail.com>
2023-01-02 18:48 ` [COFF] Re: [TUHS] Re: A few comments on porting the Bourne shell Dan Cross
2023-01-02 19:53 ` [COFF] Re: [TUHS] " Adam Thornton
[not found] ` <8ca17d52-a25a-dbbf-e1f0-d743b8884cfa@in-ulm.de>
[not found] ` <b689c244-3ea9-4fd6-bb45-a59d131071d6@app.fastmail.com>
[not found] ` <CAK0pxsH6bWTLVApE_vDhATmMgaF+nwc5D3pSz4srtwGS-8Ux_A@mail.gmail.com>
2023-01-03 23:02 ` [COFF] Re: [TUHS] Re: Command Line Editing in the Terminal Driver (Was: A few comments on porting the Bourne shell) Adam Thornton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221231115719.B97EE21FB4@orac.inputplus.co.uk \
--to=ralph@inputplus.co.uk \
--cc=coff@tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).