Toggle navigation
Toggle navigation
This project
Loading...
Sign in
송용우
/
oss-Jaksimsamil
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
JJuOn
2020-09-07 20:32:21 +0900
1
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8c401e2052cbdc8267f8c7ab9811d4b2b547e788
8c401e20
1 parent
b76a7c9a
Pass UnicodeEncodeError
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
jaksimsamil-crawler/main.py
jaksimsamil-crawler/main.py
View file @
8c401e2
...
...
@@ -23,11 +23,11 @@ def setup():
def
save
(
df
,
path
=
'problems.csv'
):
print
(
'Saving to {}...'
.
format
(
path
),
end
=
''
)
df
.
to_csv
(
path
)
df
.
to_csv
(
path
,
encoding
=
'utf-8-sig'
)
print
(
'Done.'
)
def
load
(
path
=
'problems.csv'
):
problems
=
pd
.
read_csv
(
path
,
index_col
=
0
)
problems
=
pd
.
read_csv
(
path
,
index_col
=
0
,
encoding
=
'utf-8-sig'
)
return
problems
def
get_khu_problem_list
():
...
...
@@ -119,11 +119,15 @@ def get_category(problems):
problemListLen
=
len
(
problemList
)
for
problemNum
in
problems
[
'problemNum'
]
.
values
:
if
idx
<
problemListLen
and
int
(
problemList
[
idx
][
'id'
])
==
int
(
problemNum
):
try
:
category
=
json
.
loads
(
problems
.
loc
[
problems
.
problemNum
==
problemNum
,
'category'
]
.
values
[
0
])
category
.
append
(
tag
[
'full_name_ko'
])
problems
.
loc
[
problems
.
problemNum
==
problemNum
,
'category'
]
=
json
.
dumps
(
category
,
ensure_ascii
=
False
)
idx
+=
1
print
(
'Problem {} in category {}'
.
format
(
problemNum
,
tag
[
'full_name_ko'
]))
except
UnicodeEncodeError
:
print
(
'Error occured in {}'
.
format
(
problemNum
),
file
=
sys
.
stderr
)
pass
save
(
problems
,
SAVE_PATH
)
return
problems
...
...
송용우
@2019102188
2020-09-26 12:41:26 UTC
Mentioned in commit
16aba071
Please
register
or
login
to post a comment