我的日志文件包含许多像这样的片段:
Align set A and merge into set B ...
setA, 4 images , image size 146 X 131
setA, image 1, shape center shift (7, -9) compared to image center
setA, image 2, shape center shift (8, -10) compared to image center
setA, image 3, shape center shift (6, -9) compared to image center
setA, image 4, shape center shift (6, -8) compared to image center
final set B, image size 143 X 129
Write set B ...
现在,我想将此切片中的数字提取到表格中:
| width_A | height_A | shift_x | shift_y | width_B | height_B|
--- | --- | --- | ----| ---
A1 | 146 | 131 | 7 | -9 | 143 | 129
A2 | 146 | 131 | 8 | -10 | 143 | 129
A3 | 146 | 131 | 6 | -9 | 143 | 129
A4 | 146 | 131 | 6 | -8 | 143 | 129
如果将程序分为两部分,那么:
data
,例如data['A1']['shift_x'] = 7
。 df = pd.DataFrame(data)
但我不熟悉python文本处理:
有没有人有这个好的解决方案? Python是首选。提前谢谢。