后浪云Python教程:python如何取数组后几位?
python中去数组后几位的方法:
一维数组输出最后一位的方法:
output = [1,2,3] print(output[-1])
输出结果:
3
输出后两位:
output = [1,2,3] print(output[-2:])
输出结果:
[2, 3]
二维数组输出最后一位:
output = [[1,2,3], [4,5,6], [2, 5, 6]] print(output[1][-1])
输出结果:
6
版权声明:
作者:后浪云
链接:https://www.idc.net/help/182507/
文章版权归作者所有,未经允许请勿转载。
THE END