I've problem in the comparison line line == a[1] because it doesn't go to this loop. I tried testing the output and found that there is value 'a' in the file already. Below is my code.
a = "djsajdlasak"
f = open('users.txt','r+')
k = 0
for line in f:
print line
if line == a:
k = 1
if k == 0:
f.write(a + '\n')
f.close()