Python: slicing
# python slicing 和函数range 差不多, 起始值,最后值,步长值 a='abcdefghijklmnopqrstuvwxyz' print(a[:],end=' \n') # abcdefghijklmnopqrstuvwxyz print(a[:5], end=' \n') #abcde print(a[:-1], end=' \n') #abcdefghijklmnopqrstuvwxy print(a[4:], end=' \n') #efghijklmnopqrstuvwxyz print(a[-3:], end=' \n') #xyz print(a[2:-1], end=' \n') #cdefghijklmnopqrstuvwxy print(a[-3:-1], end=' \n') #xy print(a[12:6:-1], end=' \n') #mlkjih print(a[::-1], end=' \n') #zyxwvutsrqponmlkjihgfedcba print() a=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] print(a[:],end=' \n') # abcdefghijklmnopqrstuvwxyz print(a[:5], end=' \n') #abcde print(a[:-1], end=' \n') #abcdefghijklmnopqrstuvwxy print(a[4:], end=' \n') #efghijklmnopqrstuvwxyz print(a[-3:], end=' \n') #xyz print(a[2:-1], end=' \n') #cdefghijklmnopqrstuvwxy print(a[-3:-1], end=' \n') #xy print(a[12:6:-1], end=' \n') #mlkjih print(a[::-1], end=' \n') #zyxwvutsrqponmlkjihgfedcba
哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)生存.---Geovin Du(涂聚文)