I've got a text file containing multiple jobtitle. I want to remove the title that reoccurs. I created 2 empty array, one for all jobtitle and another which stores non-duplicate values. The code i've used is:
with open('jobtitle.txt') as fp:
jobtitle =[]
jobtitle_original = []
for line in fp:
jobtitle.append(line)
for i in range(0,len(jobtitle)):
for j in range(0,len(jobtitle_original)):
if jobtitle_original[j] == jobtitle[i]:
continue
else:
jobtitle_original.append(jobtitle[i])
print jobtitle_original
But it returns me an empty array. I'm using Python 2.7.
jobtitle_originalis 0 length in the beginning so the inner loop body is never executed.