Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.python > #7656
| Path | csiph.com!aioe.org!bofh.it!tornado.fastwebnet.it!53ab2750!not-for-mail |
|---|---|
| Subject | Re: Iterazione Python |
| References | <tW1Xy.44957$pt.24847@tornado.fastwebnet.it> <ngicl7$85h$1@virtdiesel.mng.cu.mi.it> <572CF68F.2080600@smith.it> <ngitr1$kqp$1@virtdiesel.mng.cu.mi.it> |
| Newsgroups | it.comp.lang.python |
| From | Smith <smith@smith.it> |
| Message-ID | <572F169E.1080208@smith.it> (permalink) |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 |
| MIME-Version | 1.0 |
| In-Reply-To | <ngitr1$kqp$1@virtdiesel.mng.cu.mi.it> |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Lines | 23 |
| Date | Sun, 8 May 2016 12:36:14 +0200 |
| NNTP-Posting-Host | 93.34.176.20 |
| X-Complaints-To | newsmaster@fastweb.it |
| X-Trace | tornado.fastwebnet.it 1462703774 93.34.176.20 (Sun, 08 May 2016 12:36:14 CEST) |
| NNTP-Posting-Date | Sun, 08 May 2016 12:36:14 CEST |
| Xref | csiph.com it.comp.lang.python:7656 |
Show key headers only | View raw
On 06/05/2016 22:12, Andrea D'Amore wrote:
> On 2016-05-06 19:54:55 +0000, Smith said:
>
>> Se provo con zip() :
>>
>> numbers = [1,2,3,4,5]
>> letters = ["A", "B", "C"]
>> for x,j in zip(numbers,letters):
>> print(x,j)
>>
>> Non mi restituisce le due liste complete:
>
> E fa bene, le due liste sono di lunghezza diversa.
>
> Cerca il package itertools nella stdlib.
>
>
Risolto :
from itertools import zip_longest
numbers = [1,2,3,4,5]
letters = ["A", "B", "C"]
for x, j in zip_longest(numbers, letters,):
print(x,j)
Back to it.comp.lang.python | Previous | Next — Previous in thread | Find similar
Iterazione Python Smith <smith@smith.it> - 2016-05-06 16:32 +0200
Re: Iterazione Python Andrea D'Amore <anddam+NOSPAM@brapi.net> - 2016-05-06 17:19 +0200
Re: Iterazione Python Smith <smith@smith.it> - 2016-05-06 21:54 +0200
Re: Iterazione Python Andrea D'Amore <anddam+NOSPAM@brapi.net> - 2016-05-06 22:12 +0200
Re: Iterazione Python Smith <smith@smith.it> - 2016-05-07 21:01 +0200
Re: Iterazione Python Smith <smith@smith.it> - 2016-05-07 21:03 +0200
Re: Iterazione Python Smith <smith@smith.it> - 2016-05-08 12:36 +0200
csiph-web