Learning Diary for Week Eight
Learning Diary for Week Eight
一、 路况预测竞赛学习情况
为了进行比赛,这周学习了python有关切片的内容
1、python切片
比如,一个list如下:
L = ['Michael', 'Sarah', 'Tracy', 'Bob', 'Jack']
取前3个元素,应该怎么做?
方法一:
print([L[0], L[1], L[2]])
#运行结果:['Michael', 'Sarah', 'Tracy']
取前N个元素呢?
r = []
n = 3
for i i
原创
2020-10-29 21:34:17 ·
246 阅读 ·
0 评论