#!/usr/bin/python3
import os
import sys
input_list = input("please in put file name: src file,ref file,dst file\n")
input_list_split = input_list.split(',')
src_handle = open(input_list_split[0],'r')
ref_handle = open(input_list_split[1],'r')
if not os.path.exists(input_list_split[2]):
os.mknod(input_list_split[2])
dst_handle = open(input_list_split[2],'r+')
ref_lines = ref_handle.readlines()
while(1):
src_line = src_handle.readline()
if (len(src_line) == 0):
break
else:
for line_tmp in ref_lines:
if src_line in line_tmp:
dst_handle.write(line_tmp)
break
src_handle.close()
ref_handle.close()
dst_handle.close()
#!/usr/bin/python3
import os
import sys
input_list = input("please in put file name: src file,ref file,dst file\n")
input_list_split = input_list.split(',')
src_handle = open(input_list_split[0],'r')
ref_handle = open(input_list_split[1],'r')
if not os.path.exists(input_list_split[2]):
os.mknod('input_list_split[2]')
dst_handle = open(input_list_split[2],'r+')
src_lines = ref_handle.readlines()
ref_lines = ref_handle.readlines()
for cur_src_line in src_lines:
in_line_tmp = 0
for ref_line in ref_lines:
if ref_line in cur_src_line:
in_line_tmp = 1
break
if in_line_tmp == 1:
continue
else:
dst_handle.write(cur_src_line)
src_handle.close()
ref_handle.close()
dst_handle.close()