Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박은주
/
Todays_Issue
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
박은주
2021-06-08 17:28:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5aa11833d6fa2d56b041b975e82f0084bb283737
5aa11833
1 parent
0a3ef219
Add txt type output
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
content.py
content.py
View file @
5aa1183
...
...
@@ -34,8 +34,8 @@ def TextPreprocess(text):
def
GetData
():
login_info
=
{
'userID'
:
'
**********
'
,
'userpw'
:
'
**********
'
'userID'
:
'
qdw0313
'
,
'userpw'
:
'
fejUfrQxHWwtcGcP0
'
}
options
=
webdriver
.
ChromeOptions
()
...
...
@@ -108,19 +108,24 @@ def GetData():
break
break
post_df
.
to_csv
(
'data.csv'
,
mode
=
'w'
,
encoding
=
'utf-8-sig'
,
index
=
False
)
print
(
"CVS file saved"
)
with
open
(
'data.json'
,
'w+'
,
encoding
=
'utf-8-sig'
)
as
json_file
:
# post_df.to_csv('data.csv', mode='w', encoding='utf-8-sig', index=False)
# print("CVS file saved")
#
# with open('data.json', 'w+', encoding='utf-8-sig') as json_file:
# for post in zip(post_df['title'].tolist(), post_df['content'].tolist()):
# json.dump({
# "document" :
# {
# "type" : "PLAIN_TEXT",
# "content" : post[0] + post[1]
# },
# "encodingType" : "UTF8"
# }, json_file, ensure_ascii=False)
# print("JSON file saved")
with
open
(
'data.txt'
,
'w'
,
encoding
=
'utf-8-sig'
)
as
txt_file
:
for
post
in
zip
(
post_df
[
'title'
]
.
tolist
(),
post_df
[
'content'
]
.
tolist
()):
json
.
dump
({
"document"
:
{
"type"
:
"PLAIN_TEXT"
,
"content"
:
post
[
0
]
+
post
[
1
]
},
"encodingType"
:
"UTF8"
},
json_file
,
ensure_ascii
=
False
)
print
(
"JSON file saved"
)
txt_file
.
write
(
post
[
0
]
+
post
[
1
]
+
'.
\n
'
)
print
(
"txt file saved"
)
GetData
()
\ No newline at end of file
...
...
Please
register
or
login
to post a comment