Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최재웅
/
menu_recommand_webpage
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
EC2 Default User
2022-06-07 21:16:15 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b641d16c8346680c45b0d576e12016b6e263faf1
b641d16c
1 parent
e01fe437
fix fileread.py to read file using variables
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
CHATBOT/fileread_practice.py
CHATBOT/fileread_practice.py
0 → 100644
View file @
b641d16
def
print_menu
():
import
sys
import
io
f1
=
io
.
open
(
sys
.
argv
[
1
],
"r"
,
encoding
=
"utf-8"
)
f2
=
io
.
open
(
sys
.
argv
[
2
],
"r"
,
encoding
=
"utf-8"
)
list_compare
=
list
()
list1
=
[]
for
i
in
list
(
f1
):
list1
.
append
(
i
)
list2
=
[]
for
i
in
list
(
f2
):
list2
.
append
(
i
)
for
i
in
list1
:
if
i
in
list2
:
list_compare
.
append
(
i
)
list_compare_fixed
=
[
item
.
strip
()
for
item
in
list_compare
]
fl
=
open
(
"/home/ec2-user/menu_recommand_webpage-1/CHATBOT/final.txt"
,
'w'
)
for
i
in
list_compare_fixed
:
I
=
i
.
encode
(
'utf8'
)
fl
.
write
(
I
)
fl
.
write
(
'
\n
'
)
fl
.
close
()
print
(
"complete!"
)
sys
.
stdout
.
flush
()
if
__name__
==
'__main__'
:
print_menu
()
\ No newline at end of file
Please
register
or
login
to post a comment