Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python convert b string to dict

# python3
import ast
byte_str = b"{'one': 1, 'two': 2}"
dict_str = byte_str.decode("UTF-8")
mydata = ast.literal_eval(dict_str)
print(repr(mydata))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #convert #string #dict
ADD COMMENT
Topic
Name
5+1 =