filename="./tune_result.txt"
with open(filename,"r") as f :
lines = f.readlines()
lines = [line.strip().replace("'","\"") for line in lines]
import json
dict_collection = [json.loads(line) for line in lines]
import collections
super_dict = collections.defaultdict(list)
for d in dict_collection:
for k, v in d.items(): # d.items() in Python 3+
super_dict[k].append(v)
'파이썬\python' 카테고리의 다른 글
<Python> None (null)값 확인 (0) | 2021.07.22 |
---|---|
<Python> 예외처리 에러목록 ErrorList (0) | 2021.05.10 |
<파이썬 / python> 문자열 포매팅 하기 string formatting (0) | 2021.04.28 |
<파이썬 에러> TypeError: cannot perform reduce with flexible type (0) | 2021.03.25 |
<Python> 내장함수 map() (0) | 2020.06.13 |