Python | リストをソートする方法

iPython

In [1]: company = ['test3', 'test5', 'test0', 'test1', 'test2']

In [2]: company.sort()

In [3]: company
Out[3]: ['test0', 'test1', 'test2', 'test3', 'test5']

In [4]: staff = ['loud', 'apex', 'ezweb', 'bbc']

In [5]: staff.sort()

In [6]: staff
Out[6]: ['apex', 'bbc', 'ezweb', 'loud']

In [7]: company.sort(reverse=True)

In [8]: company
Out[8]: ['test5', 'test3', 'test2', 'test1', 'test0']

In [9]: staff.sort(reverse=True, key=len)

In [10]: staff
Out[10]: ['ezweb', 'apex', 'loud', 'bbc']