首页 技术 正文
技术 2022年11月16日
0 收藏 721 点赞 4,484 浏览 1459 个字
Operation Result Trans
x in s True if an item of s is equal to x, else False x值是否在s列表中
x not in s False if an item of s is equal to x, else True x值是否不在s列表中
s + t the concatenation of s and t 拼接s和t
s * n or n * s equivalent to adding s to itself n times 将s列表重复n遍
s[i] ith item of s, origin 0 取s列表中某一个值
s[i:j] slice of s from i to j 切片方式取s列表中 i 到(j-1)的连续索引对应的值
s[i:j:k] slice of s from i to j with step k 切片方式取s列表中 i 到(j-1),步长为k的索引对应的值
len(s) length of s 获取s列表的长度 等同于 s.__len__()
min(s) smallest item of s 获取s列表中的最小值 
max(s) largest item of s 获取s列表中的最大值 
s.index(x[, i[, j]]) index of the first occurrence of x in s (at or after index i and before index j) 获取x值在s列表中(从索引 i 到(j-1))的索引(第一个出现的)
s.count(x) total number of occurrences of x in s 获取x值在s列表中的个数
Operation Result Trans
s[i] = x item i of s is replaced by x  
s[i:j] = t slice of s from i to j is replaced by the contents of the iterable t  
del s[i:j] same as s[i:j] = []  
s[i:j:k] = t the elements of s[i:j:k] are replaced by those of t  
del s[i:j:k] removes the elements of s[i:j:k] from the list  
s.append(x) appends x to the end of the sequence (same as s[len(s):len(s)] = [x])  
s.clear() removes all items from s (same as dels[:])  
s.copy() creates a shallow copy of s (same as s[:])  
s.extend(t) or s += t extends s with the contents of t (for the most part the same as s[len(s):len(s)]= t)  
s *= n updates s with its contents repeated n times  
s.insert(i, x) inserts x into s at the index given by i(same as s[i:i] = [x])  
s.pop([i]) retrieves the item at i and also removes it from s  
s.remove(x) remove the first item from s where s[i]== x  
s.reverse() reverses the items of s in place  
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,497
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,910
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,744
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,498
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,136
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,300