Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'responding': 0.07; 'locale': 0.09; 'python': 0.11; "'0',": 0.16; "'a',": 0.16; "'b',": 0.16; "'c',": 0.16; "'d',": 0.16; "'e',": 0.16; "'o',": 0.16; "'r',": 0.16; "'w',": 0.16; 'meanwhile': 0.16; 'sorted()': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'all,': 0.19; 'result.': 0.19; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'sort': 0.25; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'url:python': 0.33; 'monday,': 0.33; 'december': 0.35; "didn't": 0.36; 'url:org': 0.36; 'starting': 0.37; 'to:addr:python-list': 0.38; 'fact': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'according': 0.40; 'how': 0.40; 'url:3': 0.61; "you're": 0.61; 'charset:windows-1252': 0.65; 'received:74.208': 0.68; 'default': 0.69; "'2',": 0.84; "'3',": 0.84; 'order:': 0.84 Date: Sat, 02 May 2015 15:25:36 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Custom alphabetical sort References: <40d108ec-b019-4829-a969-c8ef513866f1@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:urNugTIEWiR4WR4eXdjmIXIXrwxSaoCVqaaTCw6QXaExMsuQ9T8 QSIWW7FgLBOnGQ3XjmpIBJwlMPG3dg8c05X+lcz7X7fdk/U9E/Uilk4ShS153hWV4i4Rt/J 71wTgTu4izXeYCpSZwDaFIzwe2oUKLFOqozaFkk1xKIXP5lmoIMt+rmz5eKD19iJUjpc6o9 m8HA5sl9y2VZ8bwXr432Q== X-UI-Out-Filterresults: notjunk:1; X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430594753 news.xs4all.nl 2867 [2001:888:2000:d::a6]:50167 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:89789 On 05/02/2015 11:35 AM, Pander Musubi wrote: > On Monday, 24 December 2012 16:32:56 UTC+1, Pander Musubi wrote: >> Hi all, >> >> I would like to sort according to this order: >> >> (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', 'Å', 'b', 'B', 'c', 'C', 'ç', 'Ç', 'd', 'D', 'e', 'E', 'ë', 'Ë', 'é', 'É', 'ê', 'Ê', 'è', 'È', 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'ï', 'Ï', 'í', 'Í', 'î', 'Î', 'ì', 'Ì', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'ñ', 'N', 'Ñ', 'o', 'O', 'ö', 'Ö', 'ó', 'Ó', 'ô', 'Ô', 'ò', 'Ò', 'ø', 'Ø', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'ü', 'Ü', 'ú', 'Ú', 'û', 'Û', 'ù', 'Ù', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z') >> >> How can I do this? The default sorted() does not give the desired result. >> >> Thanks, >> >> Pander > > Meanwhile Python 3 supports locale aware sorting, see https://docs.python.org/3/howto/sorting.html > You're aware that the message you're responding to is 16 months old? And answered pretty thoroughly, starting with the fact that the OP's desired order didn't match any particular locale. -- DaveA