I am reading two files and comparing two to find lines that greylist\_previous not having it but greylist\_current having and output to the new file. I am trying to figure out the faster way to process it. If you guys has better solution please reply. Thank you.

```
prev_f = open('greylist_prev.txt')
current_f=open('greylist_current.txt')
greylist_f=open('greylist.txt','w')

prev_line = prev_f.readlines()
greylist=[]
total_line=sum(1 for line in open('greylist_current.txt'))

if total_line < 10:
  greylist_f.write("\n")

else:
   for current_line in current_f:
          if current_line not in prev_line:
                greylist.append(current_line)

for line in greylist:
   greylist_f.write("%s" %line)

prev_f.close()
current_f.close()
greylist_f.close()

```

is it same result as linux command 

```
awk -F, 'NR==FNR{_1[$1]++;next}!_1[$1]' greylist_prev.txt greylist_current.txt > greylist.txt

```