【发布时间】:2021-04-22 07:26:44
【问题描述】:
我遇到了一个奇怪的 JSON 响应,需要将其保存到 excel 中,我尝试了 pandas,但它不能以预期的方式工作(或者我使用不正确,我是 python 新手),现在我我正在尝试使用xlwt 对其进行格式化,但我在JSON 中得到的唯一params 响应是“高度、左侧、顶部、宽度”:
例如:
{'rect': {'angle': -90, 'height': 12, 'left': 31, 'top': 22, 'width': 12}, 'word': 'A'}, {'rect': {'angle': -90, 'height': 12, 'left': 301, 'top': 23, 'width': 14}, 'word': 'B'}, {'rect': {'angle': -90, 'height': 11, 'left': 698, 'top': 25, 'width': 11}, 'word': 'D'}, {'rect': {'angle': -90, 'height': 10, 'left': 829, 'top': 25, 'width': 12}, 'word': 'E'}, {'rect': {'angle': -90, 'height': 11, 'left': 909, 'top': 23, 'width': 14}, 'word': 'F'}, {'rect': {'angle': -90, 'height': 12, 'left': 993, 'top': 24, 'width': 13}, 'word': 'G'}, {'rect': {'angle': -90, 'height': 12, 'left': 1076, 'top': 24, 'width': 12}, 'word': 'H'}........还有更多行
我不能只遍历它,因为这样做不会开始新行。
请告诉我如何利用“高度、左侧、顶部、宽度”。
【问题讨论】: