Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def user_input():
- filename = input("please enter full name and extenstion of file to be compared: ")
- with open(filename, 'r') as open_file:
- made_to_list = open_file.read()
- made_to_list = made_to_list.split() #split makes each name a string element of the array all_text
- return made_to_list
- def list_comparator(list1, list2):
- common_element = []
- for element in list1:
- if element in list2:
- common_element.append(element)
- return common_element
- if __name__ == '__main__':
- print("The common items between the two lists u entered are: \n" +str(list_comparator(user_input(), user_input())))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement