Python自学:第三章 倒着打印列表
# -*- coding: GBK -*-
#reverse: 相反的
cars = ["bmw", "audi", "toyota", "subaru"] print(cars) cars.reverse()
print(cars)
输出为:
['bmw', 'audi', 'toyota', 'subaru']
['subaru', 'toyota', 'audi', 'bmw']
Python自学:第三章 倒着打印列表的更多相关文章
- Python自学:第三章 确定列表长度
>>> cars = ["bmw", "audi", "toyota", "subaru"] > ...
- Python自学:第三章 使用函数sort( )对列表进行临时排序
# -*- coding: GBK -*- cars = ["bmw", "audi", "toyota", "subaru&qu ...
- Python自学:第三章 使用方法sort( )对列表进行永久性排序
cars = ["bmw", "audi", "toyota", "subaru"] cars.sort() print ...
- Python自学:第三章 动手试一试 3-4、3-5
# -*- coding: GBK -*- liebiao = ["zhang", "li", "wang", "zhou&quo ...
- Python自学:第三章 根据值删除元素
motorcycles = ["honda", "yamaha", "suzuki", "ducati"] print( ...
- Python自学:第三章 弹出列表中任何位置处的元素
motorcycles = ["honda", "yamaha", "suzuki"] first_owned = motorcycles. ...
- Python自学:第三章 使用方法pop()删除元素
motorcycle = ["honda", "yamaha", "suzuki"] last_owned = motorcycle.pop ...
- Python自学:第三章 使用del语句删除元素
motorcycles = ["honda", "yamaha", "suzuki"] print(motorcycles) del mot ...
- Python自学:第三章 在列表末尾添加元素与在列表中插入元素
motorcycles = ['honda', 'yamaha' ,'suzuki'] motorcycles.insert(0, "ducati") print(motorcyc ...
随机推荐
- 理解JS深拷贝
前言: JS的拷贝(copy),之所以分为深浅两种形式,是因为JS变量的类型存在premitive(字面量)与reference(引用)两种区别.当然,大多数编程语言都存在这种特性. 众所周知,内存包 ...
- redis 简单的注册
首页写一个页面 <form method="post" action="hreg.php"> Name:<input type="t ...
- python学习笔记之线程、进程和协程(第八天)
参考文档: 金角大王博客:http://www.cnblogs.com/alex3714/articles/5230609.html 银角大王博客:http://www.cnblogs.com/wup ...
- UDP广播-缓冲区过小
上次介绍到了关于客户端实时刷新摄像头所识别的图片的一些方法,采用了了UDP广播的技术做处理.理论上是没有问题的,将客户端运行在不同电脑上也能很好的看到效果,运行日志也没看出啥问题,结果今天翻看日志的时 ...
- polyfillJS生成promise对象
https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js
- 编译jmeter5.0源码
jmeter5.0使用过程中,遇到request或者response乱码的情况,想要一次性解决这个问题,需要编译ApacheJMeter_http.jar这个包(lib\ext文件下)里的Reques ...
- 错误:软件包:3:docker-ce-18.09.4-3.el7.x86_64 (docker-ce-stable) 需要:container-selinux >= 2.9
命令:yum -y install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.68-1. ...
- json键和值转数组
var jb={"美的":49,"三星":35,"海信":25,"格力":16,"方太":14}; ...
- 类成员(static)和final修饰符
在Java类里只能包含成员变量.方法.构造器.初始化块.内部类(包括接口.枚举)5种成员,类成员是用static来修饰的,其属于整个类. 当使用实例来访问类成员时,实际上依然是委托给该类来访问类成员, ...
- textfield reload issue and other things reload problem.===================================
https://github.com/flutter/flutter/issues/18828 https://blog.csdn.net/u011272795/article/details/830 ...