For example I have line like this:
iamonlywhoknock BREAKINGBAD
what means
'iamonlywhoknock BREAKINGBAD\n'
Its str, but I need to create Dict, like this:
{"iamonlywhoknock":"BREAKINGBAD"}
Any ideas?
Something like this?
>>> s='iamonlywhoknock BREAKINGBAD\n'
>>> k, v = s.split()
>>> {k: v}
{'iamonlywhoknock': 'BREAKINGBAD'}
x='iamonlywhoknock BREAKINGBAD\n'.split(" ")
mydict={x[0]:x[1]}
This should work for you. It is basic string splitting :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With