69pao国产精品视频-久久精品一区二区二三区-精品国产精品亚洲一本大道-99国产综合一区久久

Python 字典 Dictionary str()方法

Python 字典 Dictionary str()方法

Python 字典 DictionaryPython 字典 Dictionary

Python 字典(Dictionary) str() 函數(shù)將值轉(zhuǎn)化為適于人閱讀的形式,以可打印的字符串表示。

 

語法

str()方法語法:

str(dict)

 

參數(shù)

  • dict -- 字典。

 

返回值

返回字符串。

 

實例

以下實例展示了 str()函數(shù)的使用方法:

 

實例

#!/usr/bin/python

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

以上實例輸出結(jié)果為:

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

Python 字典 DictionaryPython 字典 Dictionary

下一節(jié):Python 字典(Dictionary) type()方法

Python 教程

相關(guān)文章