使用matlib 将细胞 {'MDO121214B1C.pos:2021/08/02'} {'IISC21214B1C.pos:2021/08/02'} {'ALIC21214B1C.pos:2021/08/02'} {'WHU221214B1C.pos:2021/08/02'} {'KITG21214B1C.pos:2021/08/02'} {'MIZU21214B1C.pos:2021/08/02'} {'POL221214B1C.pos:2021/08/02'} {'TASH21214B1C.pos:2021/08/02'} {'USUD21214B1C.pos:2021/08/02'}变为 {'MDO1'} {'IISC'} {'ALIC'} {'WHU2'} {'KITG'} {'MIZU'} {'POL2'} {'TASH'} {'USUD'}
时间: 2023-03-24 14:03:38 浏览: 69
用matlab对细胞分割
5星 · 资源好评率100%
可以使用以下代码将细胞转换为所需格式:
import re
cells = {'MDO121214B1C.pos:2021/08/02', 'IISC21214B1C.pos:2021/08/02', 'ALIC21214B1C.pos:2021/08/02', 'WHU221214B1C.pos:2021/08/02', 'KITG21214B1C.pos:2021/08/02', 'MIZU21214B1C.pos:2021/08/02', 'POL221214B1C.pos:2021/08/02', 'TASH21214B1C.pos:2021/08/02', 'USUD21214B1C.pos:2021/08/02'}
new_cells = []
for cell in cells:
new_cell = re.findall(r'[A-Z]+', cell)[] + re.findall(r'\d+', cell)[][]
new_cells.append(new_cell)
print(new_cells)
阅读全文