Path: csiph.com!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Dominique Newsgroups: fr.comp.lang.python Subject: =?UTF-8?Q?Re=3A_Panne_de_m=C3=A9moire_avec_list_et_str?= Date: Tue, 3 Dec 2024 06:55:32 +0100 Organization: A noiseless patient Spider Lines: 36 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 03 Dec 2024 06:55:33 +0100 (CET) Injection-Info: dont-email.me; posting-host="420f8224d8ac9d7f3f3966ca8c932b08"; logging-data="4090343"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XCqGhgQMnvh8IVvBiTyG5xjJxE9/ol54=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:sDQI3vLi8Mr683Kz56TEVfnqJf8= In-Reply-To: Content-Language: fr Xref: csiph.com fr.comp.lang.python:4245 Le 02/12/2024 à 23:17, Python a écrit : > Le 02/12/2024 à 16:32, Dominique a écrit : >> Le 02/12/2024 à 12:16, Python a écrit : >> >>>>>> l = [['2'], ['2'], ['6'], ['8'], ['9']] >>>>>> ''.join(x for x, in l) >>> '22689' >>> >> >> Je te remercie pour cette réponse qui allie simplicité et élégance. Je >> me pose toute fois une question : pour quoi la virgule après le X du >> for de >> >> res=''.join(x for x, in result) >> >> Et si je le supprime, j'ai cette erreur : >> >> sequence item 0: expected str instance, list found > > _>>> a = ['4'] > _>>> type(a) > _ > _>>> a, = ['4'] > _>>> type(a) > > > > C'est très clair... et une découverte pour moi :) Merci, -- Dominique Esto quod es