Имею данные на входе типа строки :
2020.12.03 04:45:53.399: Ask = 13277.5, Bid = 13275.0, Volume = 1, Last = 13275.0, Flag = 88, Volume Real = 1.0, Type = Sell, Spread = 25
2020.12.03 04:45:54.676: Ask = 13277.5, Bid = 13274.5, Volume = 1, Last = 13277.5, Flag = 56, Volume Real = 1.0, Type = Buy, Spread = 30
2020.12.03 04:45:55.922: Ask = 13277.0, Bid = 13274.5, Volume = 1, Last = 13277.0, Flag = 56, Volume Real = 1.0, Type = Buy, Spread = 25
2020.12.03 04:45:58.570: Ask = 13277.5, Bid = 13277.0, Volume = 1, Last = 13277.0, Flag = 88, Volume Real = 1.0, Type = Sell, Spread = 5
2020.12.03 04:45:59.73: Ask = 13277.5, Bid = 13277.0, Volume = 1, Last = 13277.5, Flag = 56, Volume Real = 1.0, Type = Buy, Spread = 5
2020.12.03 04:45:59.408: Ask = 13279.5, Bid = 13277.5, Volume = 1, Last = 13278.0, Flag = 120, Volume Real = 1.0, Type = N/A, Spread = 20
2020.12.03 04:46:00.840: Ask = 13279.0, Bid = 13277.5, Volume = 1, Last = 13277.5, Flag = 88, Volume Real = 1.0, Type = Sell, Spread = 15
Как привести входящие строки в список где 2020.12.03 04:45:59.408:
это дата, а все остальное
Ask = 13279.5, Bid = 13277.5, Volume = 1, Last = 13278.0, Flag = 120, Volume Real = 1.0, Type = N/A, Spread = 20
расходится по значениям где до =
название и после =
содержание.
Также имеется код(спасибо сообществу)
text = "2020.12.02 10:47:28.819: Ask = 13332.0, Bid = 13331.5, Volume = 2, Last = 13331.5, Flag = 88, Volume Real = 2.0, Type = Sell, Spread = 5"
res = dict()
pos = text.rfind(':')
res['time'] = text[:pos]
for data in text[pos + 1:].split(","):
obj = data.split("=")
res[obj[0]] = obj[1]
print(res)
однако у res[obj[0]] = obj[1]
выходит ошибка