split byte string into lines

There is no reason to convert to string. Just give split bytes parameters. Split strings with strings, bytes with bytes.

>>> a = b'asdf\nasdf'
>>> a.split(b'\n')
[b'asdf', b'asdf']

Also, since you’re splitting on newlines, you could slightly simplify that by using splitlines() (available for both str and bytes):

>>> a = b'asdf\nasdf'
>>> a.splitlines()
[b'asdf', b'asdf']

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)