发布时间:2019-09-22 08:13:30编辑:auto阅读(1815)
sudo apt-get update
sudo apt-get install language-pack-zh-hans-base
sudo dpkg-reconfigure locales
import locale
locale.setlocale(locale.LC_COLLATE, 'zh_CN.UTF8')
cmp = locale.strcoll
courses.sort(lambda x, y: cmp(x.course_name, y.course_name))
# -*- coding: utf-8 -*-
import locale
locale.setlocale(locale.LC_COLLATE, 'zh_CN.UTF8')
cmp = locale.strcoll
items = list('自挂东南枝'.decode('utf-8'))
print 'before'.center(10, '=')
print ''.join(items)
items.sort(lambda x, y: cmp(x, y))
print 'after'.center(10, '=')
print ''.join(items)
==before==
自挂东南枝
==after===
东挂南枝自
上一篇: LRU算法——python实现
下一篇: python 使用sqlite3
47831
46369
37253
34714
29299
25960
24876
19935
19518
18005
5776°
6401°
5912°
5954°
7054°
5898°
5929°
6425°
6390°
7759°