Fastest way to read an array of numbers from python
If you don't know the length of the data then you need to be sending start and end markers so your other code can tell where the transmission starts and ends.  I usually use &lt; and >, so the data packet might look like &lt;12345678>.  You don't have to use those particular characters, just pick something that you know won't show up in your data.