我如何切割和拆分这样的列表 A = ['105200166','177288399']成 [['105','200','166'],['177','288',399']
答案 0 :(得分:0)
>>> thelist = ['105200166', '177288399']
>>> result = []
>>> for item in thelist:
... tmp = []
... sets = (len(item) + 2) // 3
... for i in range(0, sets):
... start = i * 3
... end = start + 3
... tmp.append(item[start:end])
... result.append(tmp)
...
>>> result
[['105', '200', '166'], ['177', '288', '399']]