get_alg.py 603 B

12345678910111213141516171819202122
  1. """
  2. @author: luojunhui
  3. 从飞书表读取公式
  4. """
  5. import json
  6. from feishu import Feishu
  7. F = Feishu(document_token="ZYNBsZ5lPhsKFltb6ghclfJqngb")
  8. config_json = {}
  9. w = F.search_value(sheet_id="TVBdUl", ab="A5:NA5")
  10. result = w['data']['valueRange']
  11. for index, i in enumerate(result['values'][0], 1):
  12. if type(i) == str and i != "-" and i != "--":
  13. print("c{}".format(index), "={}".format(i))
  14. key = "c{}".format(index)
  15. alg = "={}".format(i)
  16. config_json[key] = alg
  17. with open('config.json', 'w') as f:
  18. f.write(json.dumps(config_json, ensure_ascii=False, indent=4))