Commit 2cbd66bd by 岳巧源

add config

parent a469f7c4
Showing with 3 additions and 0 deletions
...@@ -39,6 +39,7 @@ def download_file(url=""): ...@@ -39,6 +39,7 @@ def download_file(url=""):
class HandleCSV: class HandleCSV:
def parse(self, path): def parse(self, path):
with open(path, encoding='gbk', errors='ignore') as f: with open(path, encoding='gbk', errors='ignore') as f:
count_msg = 0
first_line = [] first_line = []
reader = csv.reader(f) reader = csv.reader(f)
for index, row in enumerate(reader): for index, row in enumerate(reader):
...@@ -52,7 +53,9 @@ class HandleCSV: ...@@ -52,7 +53,9 @@ class HandleCSV:
json_str = self.generate_json(row, first_line) json_str = self.generate_json(row, first_line)
self.push_to_mq(json_str) self.push_to_mq(json_str)
print(json_str) print(json_str)
count_msg += 1
logger.info("文件 %s 已解析" % path) logger.info("文件 %s 已解析" % path)
logger.info("解析数据总数为 %s 条" % str(count_msg))
# 校验excel表头符合既定格式 # 校验excel表头符合既定格式
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment