How can I split a byte string into a list of lines?
In python 2 I had:
rest = \"some\\nlines\" for line in rest.split(\"\\n\"): print line
There is no reason to convert to string. Just give split bytes parameters. Split strings with strings, bytes with bytes.
split
>>> a = b'asdf\nasdf' >>> a.split(b'\n') [b'asdf', b'asdf']