Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.lang.python > #7671

List sorted

Path csiph.com!aioe.org!bofh.it!tornado.fastwebnet.it!53ab2750!not-for-mail
Newsgroups it.comp.lang.python
X-Mozilla-News-Host news://news.fastwebnet.it:119
From Smith <smith@smith.com>
Subject List sorted
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding 7bit
Lines 24
Message-ID <qP8fz.47066$pt.44734@tornado.fastwebnet.it> (permalink)
Date Wed, 6 Jul 2016 16:44:48 +0200
NNTP-Posting-Host 2.235.183.179
X-Complaints-To newsmaster@fastweb.it
X-Trace tornado.fastwebnet.it 1467816278 2.235.183.179 (Wed, 06 Jul 2016 16:44:38 CEST)
NNTP-Posting-Date Wed, 06 Jul 2016 16:44:38 CEST
Xref csiph.com it.comp.lang.python:7671

Show key headers only | View raw


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 | NextNext in thread | Find similar


Thread

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