From 93077c5ac51ca3951a82a75bc92127fb1cc18ca9 Mon Sep 17 00:00:00 2001 From: qqhsx <56535272+qqhsx@users.noreply.github.com> Date: Sat, 25 May 2024 17:03:48 +0800 Subject: [PATCH] Update popularity.py --- popularity.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/popularity.py b/popularity.py index 22b82362..fc14b01a 100644 --- a/popularity.py +++ b/popularity.py @@ -1,8 +1,9 @@ +import os import pywencai -# 定义变量 -query = '退市股票' -filename = f'{query}.csv' +# 从环境变量读取查询词 +query = os.getenv('CSV_FILE_NAME ', '退市股票') # 如果环境变量不存在,则使用默认值 '退市股票' +filename = f'{CSV_FILE_NAME }.csv' # 使用变量进行查询和保存结果 res = pywencai.get(question=query, loop=True)