python str.split(' ')[1][0]的介绍

设串line为“qwertyuiop-003-cat.jpg 12”
line.split(' ')[1][0]中的第一位[1]表示用‘ ’切片后的第二个串,[0]表示这个切片后的串列表的第一位
因此最后得到的答案为‘1’

posted @ 2022-06-29 09:57  huyinghao  阅读(512)  评论(0编辑  收藏  举报