TypeError: Type str does not support buffer API when splitting a string

Hi everyone, I have this code:

data = data.split('&') 

And I get the following error:

data = data.split ('&') TypeError: type str does not support API buffer

How to break my line?

+6
source share
1 answer

data is a bytes object. You can use a different bytes value to separate it, you can use the bytes literal (starting with the b prefix) to create it:

 data.split(b'&') 
+16
source

Source: https://habr.com/ru/post/982258/


All Articles