やったもん勝ち

主にプログラミングのこと。生産性向上の某とかも。

2017-11-28から1日間の記事一覧

python3でstrからdictに変換する

import ast str = "{'name':'Taro', 'hieght':170}" type(str) => <class 'str'> dict = ast.literal_eval(str) type(dict) => <class 'dict'> 他の記事でast.literal_dict(str) となっていたのですが、 AttributeError: module 'ast' has no attribute 'literal_dict' とエラーになって</class></class>…