I have the following line:
BL: {version: 2, revision: 1}
I want to parse it, so that I will get in one variable BL
, and on the other, I will get
[[version, revision], [2,1]]
I have the following code:
for line in file:
print line.split(':',1)[0]; gives me the first word (BL)
print line.split(': ',1)[1]
data = json.loads(json.dumps(line.split(': ',1)[1]));
The problem is that data is not contained the data as variable, so when I do data[0]
, I get the char: {
What the correct way to do that?