Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.python > #7671
| Newsgroups | it.comp.lang.python |
|---|---|
| From | Smith <smith@smith.com> |
| Subject | List sorted |
| Message-ID | <qP8fz.47066$pt.44734@tornado.fastwebnet.it> (permalink) |
| Date | 2016-07-06 16:44 +0200 |
Ciao,
ho una lista di stringhe e vorrei ordinarle e numerarle, ma
questo script non restituisce il risultato desiderato.
Potete aiutarmi?
Grazie
for i, v in sorted(enumerate(['tic', 'tac', 'toe','capo'])):
print(i,v)
0 tic
1 tac
2 toe
3 capo
Vorrei ottenere questo:
for i, v in sorted(enumerate(['tic', 'tac', 'toe','capo'])):
print(i,v)
0 capo
1 tac
2 tic
3 toe
Back to it.comp.lang.python | Previous | Next — Next in thread | Find similar
List sorted Smith <smith@smith.com> - 2016-07-06 16:44 +0200
Re: List sorted Mauro Casini <mauro@iperbole.bologna.it> - 2016-07-06 17:05 +0200
Re: List sorted Smith <smith@smith.it> - 2016-07-06 19:12 +0200
csiph-web