切片
sequence[start:stop] 表示返回[start,stop)区间的子序列[:]表示从头至尾,全部元素被取出,等效于copy()方法切片举例
‘www.magedu.com‘[4:10]‘www.magedu.com‘[4:10]‘www.magedu.com‘[:10]‘www.magedu.com‘[4:]‘www.magedu.com‘[:]‘www.magedu.com‘[:-1]‘www.magedu.com‘[4:-4]‘www.magedu.com‘[4:50]‘www.magedu.com‘[-40:10]bytearray(b‘www.magedu.com‘)[-4:10]tuple(‘www.magedu.com‘)[-10:10]list(‘www.magedu.com‘)[-10:-4]步长切片
[start:stop:step]www.magedu.com[4:10:2]
list(www.magedu.com)[4:10:-2]
tuple(www.magedu.com)[-10:-4:2]
b‘www.magedu.com‘[-4:-10:2]
bytearray(b‘www.magedu.com‘)[-4:-10:-2]
用坐标轴,来进行想象
原文:https://www.cnblogs.com/gnuzsx/p/12731731.html