I am using below code to replace a string, it is actually working, I want to know if there is better way to do it ? I just want to read data coming from serial, if it is same value do nothing but if it is new value print it...
new = ""
old = ""
while True:
new = readQR("/dev/input/event7")
if new != old:
print (new)
old = ""
old = new
new = ""
else:
new = ""
old = newyou don't needold=""andnew=""also theelseblock is not neededold, new = new, ""