str()がJavaのクラスでオーバーライドするtoString()メソッド(C#のToString()メソッド)のイメージです。repr()は引数付きのコンストラクタ(または初期化子)を文字列で返してくれる関数と解釈できます。 datetimeモジュールで確認すると分かりやすいです。 >>> import datetime >>> today = datetime.date.today() >>> str(today) '2018-04-12' >>> repr(today) 'datetime.date(2018, 4, 12)' >>> today datetime.date(2018, 4, 12) >>> x = eval(repr(today)) >>> today - x datetime.timedelta(0) 上記のコードでstr(today)で出力される‘2018-0
![Pythonのstr( )とrepr( )の使い分け - ガンマソフト](https://cdn-ak-scissors.b.st-hatena.com/image/square/04f23066e23dad5a11de8e5e59c38a9b018c0c13/height=288;version=1;width=512/https%3A%2F%2Fgammasoft.jp%2Fpu7nk3cmg8%2Fwp-content%2Fuploads%2F2018%2F04%2Fstr-repr.jpg)