daniel.t.he...@gmail.com writes: - - > Problem: The file only contains P2. It always overwrites the first > line. I can send 20 strings and the file will always contain the > last string received. - - > while True: > rawcode=ser.readline() > codelog=open('/home/pi/avdms/codes.log','w') - -
That's what file mode 'w' does. Use 'a'. Also consider the logging module. See <http://docs.python.org/3/library/functions.html#open> for open. See <http://docs.python.org/3/library/logging.html> for logging. -- https://mail.python.org/mailman/listinfo/python-list