I am looking for a simple way to split lines in python from a .txt file and then just read out the names and compare them to another file.
I've had a code that split the lines successfully, but I couldn't find a way to read out just the names, unfortunately the code that split it successfully was lost.
this is what the .txt file looks like.
Id;Name;Job; 1;James;IT; 2;Adam;Director; 3;Clare;Assisiant; example if the code I currently have (doesn't output anything)
my_file = open("HP_liki.txt","r") flag = index = 0 x1="" for line in my_file: line.strip().split('\n') index+=1 content = my_file.read() list=[] lines_to_read = [index-1] for position, line1 in enumerate(x1): if position in lines_to_read: list=line1 x1=list.split(";") print(x1[1]) I need a solution that doesn't import pandas or csv.