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
송용우
2020-09-07 21:44:58 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
16aba0719775d82348d97f645dd2286ff1ad2ded
16aba071
2 parents
b76a7c9a
8c401e20
Merge commit '
8c401e20
' into develop
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
jaksimsamil-crawler/main.py
jaksimsamil-crawler/main.py
View file @
16aba07
...
...
@@ -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
):
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'
]))
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
...
...
Please
register
or
login
to post a comment