python---split函数

a = "1.mp4,28.80;1,1,13.21,15.8"

splitstr = a.split(";")#以字符串列表的形式返回分号前的内容str1,及分号后的内容str2
# type(splitstr):list
# len(splitstr) == 2
# splitstr == ['1.mp4,28.80', '1,1,13.21,15.8']

splitstr1 = splitstr[0].split(",")
# len(splitstr1)==2
# splitstr1[0] == "1.mp4" 得到视频每个视频文件路径

splitstr2 = splitstr[1].split(",")
# len(splitstr2)==4
# splitstr2==["1","1","13.21","15.18"]



posted @ 2020-12-08 18:13  Parallax  阅读(199)  评论(0编辑  收藏  举报