python pandas 写入excel
pip install pandas openpyxl
import pandas as pd from Silence.utils.login_util import Login from Silence.utils.request_util import SendRequest def test_fun(): Login().login_system() method = 'GET' url = 'http://127.0.0.1/api/mgr/customers' params = { "action": "list_customer", "pagesize": 10000, "pagenum": 1, "keywords": "人民医院" } res = SendRequest.s.request(method, url, params=params) return res res = test_fun() # 创建一个DataFrame data = res.json()['retlist'] df = pd.DataFrame(data) # 将DataFrame写入EXCEL文件 df.to_excel('./tools/pandas写入excel.xlsx',index = False)
钟声敲响了日落,柏油路跃过山坡,一直通向北方的是我们想象,长大后也未曾经过~