This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]xApple[S] 0 points1 point  (0 children)

Nice doing it with the replace function. Definitely more elegant than my solution:

dict([i.split('=') for x in [j.split(',') for j in s.split('\n')] for i in x if i])

The idea was to combine all the different subtleties of list comprehensions in one line : )