從高到底的排序
從高到底排序,是先用sort(),然后再用reverse()嗎
下面的代碼:
L=[“tom,98”,“tony,100”,“peter,65”,“smith,70”]
L.sort()
L.reverse()
print L
從高到底排序,是先用sort(),然后再用reverse()嗎
下面的代碼:
L=[“tom,98”,“tony,100”,“peter,65”,“smith,70”]
L.sort()
L.reverse()
print L
2017-02-28
舉報
2017-02-28
此課程是基礎內容,自己排序輸出即可,還沒用用到你說的方法。
2017-02-28
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'fy'
__mtime__ = '2017/2/28'
# 歡迎進入我的主頁:https://www.zhihu.com/people/lian-fei-11/activities.
"""
L=['tony',100,'tom',98,'smith',70,'peter',65]
print L
2017-02-28
L.sort(reverse=True)