Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: Type str doesn't support the buffer API when splitting string

Hi all I have this code:

data = data.split('&')

And I get the following error:

data = data.split('&') TypeError: Type str doesn't support the buffer API

How to split my string?

like image 201
user2950593 Avatar asked Feb 10 '15 12:02

user2950593


1 Answers

datais a bytes object. You can only use another bytes value to split it, you can use a bytes literal (starting with the b prefix) to create one:

data.split(b'&')
like image 177
Martijn Pieters Avatar answered Sep 28 '22 10:09

Martijn Pieters