if __name__ == '__main__':
file ='ABC_BC_BCD__1ABC_20210930A095512_20210930A095522_033123_03E123_AABC_GUOQIN'
# 截取
# 拆分 文件名稱
splieFile = file.split("_")
length = len(splieFile)
print(length)
index = ''
# 遍歷
for i in range(length):
if( i == 6):
continue
index += splieFile[i] + "_"
str_len = len(index)
# 截取
index = index[0:str_len-1]
# 打印
print(index)
源文件長度:ABC_BC_BCD__1ABC_20210930A095512_20210930A095522_033123_03E123_AABC_GUOQIN