Python Check txt variable loop -
i need function check in name.txt variable if variable changed print 1 , again if variable 2 times change again print 1. possible in python?http://pastebin.com/qa0ed3nm
fr = open("plik.txt",'r')
first_length = len(str(fr.read()))
while true:
text = str(fr.read())
if(len(text)!=first_length):
fr.close()
fw = open("plik.txt","w")
fw.write(text)
fw.close()
print("done")
break;
may function can help:
def checkchange(filename, oldcontent): fsrc = open(filename, 'r') actualcontent = fsrc.read() fsrc.close() if actualcontent != oldcontent: print(1) return actualcontent
Comments
Post a Comment