#按行读取 for i in range(minrow,maxrow+1): for j in range(mincol,maxcol+1): cell=sheet.cell(i,j).value json_cell = json.dumps(cell) #print(cell) params_json = json.loads(json_cell) print(json_cell) #print(params_json) url = 'http://1.1.1.1:9100/shydyy/ewm/CheckTodaySjyxYxjl' headers = { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1', 'Host': '120.195.21.171:9100', 'Origin': '1.1.1.1:9999', 'Referer': '1.1.1.1:9999/', } data = { 'TEL': json_cell, 'YGH': '13400863', } for i in range(minrow, maxrow + 1): respOnse= requests.post(url, headers=headers, data=data) print(data) print(response.text) 从 excel 表格的第一行读取循环到最后一行并给一个 json 量,用的是 openpyxl 读取 赋值完成之后 我需要根据行数来确定循环多少次 openpyxl 中通过 sheet.max_row 也可实现
每次都需逐行读取 json 替换为 data 中的 TEL 参数并发送一次 POST 请求直到遍历结束
按照上面写每次都只读取最后一个数,各位大佬有什么好的办法吗?
