#coding=utf-8
s = "[[11111, 33zcef], [11111, wer]]"
def strListDemoTwo(s):
'''
:param s:
:return:
'''
s = s.replace('[', '').replace(']', '')
files = s.split(',') # 用,号分割成list
files_List = [] # 新建空list
for i in range(0, len(files), 2):
files_List.append(files[i:i + 2])
return files_List
s_list = strListDemoTwo(s)
print(s_list) # [['11111', ' 33zcef'], [' 11111', ' wer']]
str型伪list转化成list列表
最新推荐文章于 2022-09-22 20:53:54 发布