Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.python > #7599
| Path | csiph.com!goblin1!goblin3!goblin.stu.neva.ru!news.netfront.net!not-for-mail |
|---|---|
| From | "Francesco Di Matteo" <frankdimat@TEMPOlibero.it> |
| Newsgroups | it.comp.lang.python |
| Subject | Re: Contatore in funzione ricorsiva |
| Date | Sat, 17 Oct 2015 18:22:40 +0200 |
| Organization | Netfront http://www.netfront.net/ |
| Lines | 36 |
| Message-ID | <mvtskr$mps$1@adenine.netfront.net> (permalink) |
| References | <mvtcdh$csn$1@adenine.netfront.net> <mvtp46$khq$1@adenine.netfront.net> |
| NNTP-Posting-Host | 87.9.167.150 |
| X-Trace | adenine.netfront.net 1445098971 23356 87.9.167.150 (17 Oct 2015 16:22:51 GMT) |
| X-Complaints-To | news@netfront.net |
| NNTP-Posting-Date | Sat, 17 Oct 2015 16:22:51 +0000 (UTC) |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| X-Newsreader | Microsoft Outlook Express 6.00.2900.5512 |
| X-RFC2646 | Format=Flowed; Original |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.2900.5512 |
| X-Antivirus | avast! (VPS 151017-0, 17/10/2015), Outbound message |
| X-Antivirus-Status | Clean |
| Xref | csiph.com it.comp.lang.python:7599 |
Show key headers only | View raw
"Antonio Valentino" <antonio.valentino@tiscali.it> ha scritto nel messaggio
news:mvtp46$khq$1@adenine.netfront.net...
> Ciao Francesco,
>
[cut]
>
>
> esiste una funzione della libreria standard per generare le
> permutazioni: itertools.permutations.
>
> Per enumerare un iterabile si usa solitamente la funzione "enumerate".
>
> In sintesi:
>
>
> import itertools
>
> for n, i in enumerate(itertools.permutations([1, 2, 3])):
> print('{} {}'.format(n, i))
>
>
> dovrebbe fare quello che chiedi.
>
> In forma più sintetica puoi usare anche:
>
> print('\n'.join('{} {}'.format(n, i) for n, i in
> enumerate(itertools.permutations([1, 2, 3]))))
>
>
grazie davvero
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Back to it.comp.lang.python | Previous | Next — Previous in thread | Find similar
Contatore in funzione ricorsiva "Francesco Di Matteo" <frankdimat@TEMPOlibero.it> - 2015-10-17 13:45 +0200
Re: Contatore in funzione ricorsiva Leonardo Serni <lserni@gmail.com> - 2015-10-17 15:10 +0200
Re: Contatore in funzione ricorsiva Antonio Valentino <antonio.valentino@tiscali.it> - 2015-10-17 17:22 +0200
Re: Contatore in funzione ricorsiva "Francesco Di Matteo" <frankdimat@TEMPOlibero.it> - 2015-10-17 18:22 +0200
csiph-web