Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
python_script
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2cbd66bd
authored
Jul 31, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add config
parent
a469f7c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
waldom_data_process_USD.py
waldom_data_process_USD.py
View file @
2cbd66bd
...
@@ -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表头符合既定格式
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment