我有以下几行:
9 (1224) Starting item export: IPM.Appointment, Zomverbanden (wielen) monteren, 2,61 B, John \Calendar, E:\tmp\John Kn
9 (1224) Starting item export: IPM.Appointment, [JK], 7,97 KB, John Knappers\Calendar, E:
9 (1224) Starting item export: IPM.Appointment, Niet op kantoor (Auto), 1,66 GB, John \Calendar, E:\tmp\John .
9 (1224) Starting item export: IPM.Appointment, Bespip / Tobias , 9,13 KB, John \Calendar, E:\tmp\John K
9 (1224) Starting item export: IPM.Appointment, Q-ware el / Mehan [JK], 8,01 MB, \Calendar, E:\tmp\J
如何找到这些字节和兆字节的匹配模式等等?
我试过了
res = re.findall(r'(\d*,\d* KB)|(\d*,\d* MB) | (\d*,\d* B)| (\d*,\d* GB)', i)
但是它返回了4个元组的字典,但每行只需要1个项目:
2,61 B
7,97 KB
1,66 GB
9,13 KB
8,01 MB
答案 0 :(得分:0)