1 Star 0 Fork 1

zcy0776/ding-report

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
txt_to_dict.py 808 Bytes
一键复制 编辑 原始数据 按行查看 历史
ONEMT_Andy 提交于 2023-06-01 15:52 . v1.0
import json
from pathlib import Path
# 从文件中导入数据,转为dict
def txt_to_dict(filepath: str) -> dict:
try:
with open(filepath, 'r', encoding='utf-8') as fs:
s = fs.read()
s = s.replace('\t', '')
s = s.replace('\n', '')
s = s.replace(',}', '}')
return json.loads(s)
except IOError as e:
print(e)
def main():
main_path = Path(__file__).resolve().parent
access_token_path = main_path.joinpath('数据源', 'access_tokens.txt')
access_tokens = txt_to_dict(access_token_path)
gs_webhooks = ["https://oapi.dingtalk.com/robot/send?access_token=" + access_token for access_token in access_tokens['GS']]
print(gs_webhooks)
if __name__ == '__main__':
main()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/bs0776/ding-report.git
git@gitee.com:bs0776/ding-report.git
bs0776
ding-report
ding-report
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385