Mark Dickinson <dicki...@gmail.com> added the comment:

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]

----------
nosy: +mark.dickinson
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34016>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to