ticket = 535125
word = "#%d#"%ticket
flag=0
with open('ticketid.txt') as f:
for line in f:
print line
if word in line:
print("est stroka="+line)
flag=1
break
if flag==0:
print("netstroki")
handle = open("ticketid.txt", "a")
handle.write(word+"\n")
handle.close()