finding a joint set between text file and csv file

Viewed 26

trying to compare list of names from a text file, with a list of names from a csv file.

ive created a set of names from the text file using the following:

# receive text and create new list
with open('text.txt') as f:
    lines = f.readlines()
    names = []
    # add first 5 characters from lines to list to get name
    for x in lines[9:1011]:
        names.append(x[0:5])
        names.sort()
        # create set from list to eliminate duplicates
unique_name = set(names)
print(unique_name)

now id like to compare the set with a csv table with a name column and was wondering what the best way to do this is? thank you

0 Answers
Related