This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients lucassdssampaio, mark.dickinson
Date 2018-07-01.20:06:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530475595.37.0.56676864532.issue34016@psf.upfronthosting.co.za>
In-reply-to
Content
This isn't a bug: I'm guessing that you expected an output of `['6', '8', '10']`, but in the example you give you're sorting strings rather than numbers, and those strings are sorted lexicographically (i.e., using "dictionary order") as normal.

If you want to do a numeric sort, convert your inputs to numbers first.

>>> lista4 = ['6', '8', '10']
>>> lista4_numbers = [int(s) for s in lista4]
>>> lista4_numbers.sort()
>>> lista4_numbers
[6, 8, 10]
History
Date User Action Args
2018-07-01 20:06:35mark.dickinsonsetrecipients: + mark.dickinson, lucassdssampaio
2018-07-01 20:06:35mark.dickinsonsetmessageid: <1530475595.37.0.56676864532.issue34016@psf.upfronthosting.co.za>
2018-07-01 20:06:35mark.dickinsonlinkissue34016 messages
2018-07-01 20:06:35mark.dickinsoncreate