Message320844
| 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:35 | mark.dickinson | set | recipients: + mark.dickinson, lucassdssampaio |
| 2018-07-01 20:06:35 | mark.dickinson | set | messageid: <1530475595.37.0.56676864532.issue34016@psf.upfronthosting.co.za> |
| 2018-07-01 20:06:35 | mark.dickinson | link | issue34016 messages |
| 2018-07-01 20:06:35 | mark.dickinson | create | |