i have a small program for receiving a txt file from an arduino. the problem is sometimes it prints an empty file. i assume because the receiving part of the code is empty at the time. can someone help me make this code not write to the file when "t" is empty so i can prevent it from writing a blank txt file? thanks
with open('sensData.txt','wb') as f:
while True:
t = conn.recv(20)
print t
if not t:
s.close()
break
f.write(t) #Write To File UNLESS BLANK