Latest web development tutorials

Pythonの辞書(辞書)STR()メソッド

説明

Pythonの辞書(辞書)STR()関数は、人間が読める、印刷可能な文字列表現に適した値を変換します。

文法

STR()メソッドの構文:

str(dict)

パラメータ

  • 辞書 - 辞書。

戻り値

文字列を返します。

次の例では、使用する列str()関数を示しています。

#!/usr/bin/python

dict = {'Name': 'Zara', 'Age': 7};
print "Equivalent String : %s" % str (dict)

上の例の出力は、次のとおりです。

Equivalent String : {'Age': 7, 'Name': 'Zara'}