国产高清网站_亚洲一区二区综合_成人久久18免费网站_国产成人久久精品激情

您現在所在的位置:首頁 >學習資源 > Python全棧+人工智能入門教材 > Python基礎入門教程62:Python str() 函數

Python基礎入門教程62:Python str() 函數

來源:奇酷教育 發表于:

Python 內置函數,str() 函數將對象轉化為適于人閱讀的形式。


  Python 內置函數

  描述

  str() 函數將對象轉化為適于人閱讀的形式。

  語法

  以下是 str() 方法的語法:

  class str(object='')

  參數

  object -- 對象。

  返回值

  返回一個對象的string格式。

  實例

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

  >>>s = 'RUNOOB' >>> str(s) 'RUNOOB' >>> dict = {'runoob': 'runoob.com', 'google': 'google.com'}; >>> str(dict) "{'google': 'google.com', 'runoob': 'runoob.com'}" >>>