Reading arduino serial connection in python: Unknown characters

I’m using Python to talk to my Arduino using the pyserial module.

import serial
ser=serial.Serial('/dev/ttyUSB0', 115200)

I get the following results:

ser.read(20)
'y8\t0.16\t0.16\t-0.65\r\n'

That’s what I need.

But if I close port and open it again, I get the following:

ser.close()
ser=serial.Serial('/dev/ttyUSB0', 115200)
ser.read(20)
'4\xfa\x9a\xf9t\xff\x1a\xffA\xff<\xf2x\xf68\xf6A\xffA\xff'

What are these symbols? How do I get the correct characters?

My OS is Ubuntu

How do I get the correct characters?

Send the correct ones.

Opening the serial port resets the Arduino. Reading serial data while it is resetting is silly.

Have a look at this Python - Arduino demo.

...R