Python3 List reverse()方法

Python 3 教程 · 2019-02-06 13:57:25

描述

reverse() 函数用于反向列表中元素。

语法

reverse()方法语法:

list.reverse()

参数

  • NA。

返回值

该方法没有返回值,但是会对列表的元素进行反向排序。

实例

以下实例展示了 reverse()函数的使用方法:

#!/usr/bin/python3

list1 = ['Google', 'Codercto', 'Taobao', 'Baidu']
list1.reverse()
print ("列表反转后: ", list1)

以上实例输出结果如下:

列表反转后:  ['Baidu', 'Taobao', 'Codercto', 'Google']

点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html

查看所有标签

Convergence Culture

Convergence Culture

Henry Jenkins / NYU Press / 2006-08-01 / USD 30.00

"Convergence Culture" maps a new territory: where old and new media intersect, where grassroots and corporate media collide, where the power of the media producer, and the power of the consumer intera......一起来看看 《Convergence Culture》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具