Deutsch English Français Italiano |
<wUEi4TW0rVQk4Rsqr19e-18iSrc@jntp> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!pasdenom.info!from-devjntp Message-ID: <wUEi4TW0rVQk4Rsqr19e-18iSrc@jntp> JNTP-Route: nemoweb.net JNTP-DataType: Article Subject: Re: Panne de =?UTF-8?Q?m=C3=A9moire=20avec=20list=20et=20str?= References: <vik35m$393an$1@dont-email.me> <pfku1pxUSo1PjY00UnMRmj9UrQo@jntp> <vil43k$ir5$1@cabale.usenet-fr.net> Newsgroups: fr.comp.lang.python JNTP-HashClient: jY7zCsWYR1HfItzupXC5pLgMd-4 JNTP-ThreadID: vik35m$393an$1@dont-email.me JNTP-Uri: https://www.nemoweb.net/?DataID=wUEi4TW0rVQk4Rsqr19e-18iSrc@jntp User-Agent: Nemo/1.0 JNTP-OriginServer: nemoweb.net Date: Mon, 02 Dec 24 21:35:32 +0000 Organization: Nemoweb JNTP-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0 Injection-Info: nemoweb.net; posting-host="5b4a1be79effc05762607ed9b2da5480c7183194"; logging-data="2024-12-02T21:35:32Z/9126813"; posting-account="190@nemoweb.net"; mail-complaints-to="julien.arlandis@gmail.com" JNTP-ProtocolVersion: 0.21.1 JNTP-Server: PhpNemoServer/0.94.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-JNTP-JsonNewsGateway: 0.96 From: Python <jpierre.messager@gmail.com> Bytes: 1773 Lines: 16 Le 02/12/2024 à 21:08, Olivier Miakinen a écrit : > Le 02/12/2024 12:16, Python a écrit : >> >>>>> l = [['2'], ['2'], ['6'], ['8'], ['9']] >>>>> ''.join(x for x, in l) >> '22689' > > Impressionnant. Je n'aurais jamais pensé à la syntaxe « x, » pour extraire > le premier (et seul) élément de chaque sous-tableau. et s'il est pas seul ça peut marcher aussi : > > > l = [['2', '3'], ['2', 'spam'], ['6', 'ham', 'egg', 12 ], ['8'], ['9']] > > > ''.join(x for x,*_ in l) '22689'