list to string python
>>> L = [1,2,3]
>>> " ".join(str(x) for x in L)
'1 2 3'
list to string python
>>> L = [1,2,3]
>>> " ".join(str(x) for x in L)
'1 2 3'
list to string python
list1 = ['1', '2', '3']
str1 = ''.join(list1)
convert string representation of dict to dict python
>>> import ast
>>> ast.literal_eval("{'muffin' : 'lolz', 'foo' : 'kitty'}")
{'muffin': 'lolz', 'foo': 'kitty'}
poython str to dict
>>> D1={'1':1, '2':2, '3':3}
>>> s=str(D1)
>>> import ast
>>> D2=ast.literal_eval(s)
>>> D2
{'1': 1, '2': 2, '3': 3}
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))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us