EC2 Default User

fix fileread.py to read file using variables

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