import re
s = ['t__f326ea56',
'foo\tbar\tquax',
'some\ts\tstring']
new_data = [re.split("\\t", i) for i in s]
s1 = new_data[0][0]
s2, s3, s4 = map(list, zip(*new_data[1:]))
输出:
^{pr2}$
编辑:
对于列表:
s = [['t__f326ea56', 'foo\tbar\tquax', 'some\ts\tstring'], ['second\tbar\tfoo', 'third\tpractice\tbar']]
new_s = [[re.split("\\t", b) for b in i] for i in s]
使用“直线”
str.split()
函数:输出:
^{pr2}$您可以在
re
模块中使用split()
方法:输出:
^{pr2}$编辑:
对于列表:
new_s
现在存储:要转置
new_s
中的数据:final_s
现在将以您想要的原始方式存储数据:相关问题 更多 >
编程相关推荐