Python3---常見函數---type()


0X01;功能描述

  type() 函數如果你只有第一個參數則返回對象的類型,三個參數返回新的類型對象。

0X02;語法:

  type(object)

  type(name,bases,dict)

  • name -- 類的名稱。
  • bases -- 基類的元組。
  • dict -- 字典,類內定義的命名空間變量。

0X03;舉例:

1 print(type(1))
2 print(type('1'))
3 print(type([2]))
#運行結果:
C:\Users\aaron\Desktop\Pytoon-cade\venv\Scripts\python.exe C:/Users/aaron/Desktop/Pytoon-cade/urllib-Study.py
<class 'int'>
<class 'str'>
<class 'list'>

Process finished with exit code 0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM