Python type()

📔 : Python 🔗

predefined function type() का python में variables का type जानने के लिए किया जाता है।

Python type() Syntax

type(object)
  1. object | required : function में pass किया गया argument है जिसका type के बारे में पता करना है , यह argument required होता है।

Python type() Example

Copy Fullscreen Close Fullscreen Run
print( type("String") )  #string.
print( type(2) )         #int.
print( type(4.6) )       # float.
print( type((23,34)) )   #tuple.
print( type({23,34}) )   #set.
print( type([23,34]) )   #list.
print( type({"name":"rahul", "age":23}) )   #dictionary. 
Output
C:\Users\Rahulkumar\Desktop\python>python checkType.py
<class 'str'>
<class 'int'>
<class 'float'>
<class 'tuple'>
<class 'set'>
<class 'list'>
<class 'dict'>

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! My name is Rahul Kumar Rajput. I'm a back end web developer and founder of learnhindituts.com. I live in Uttar Pradesh (UP), India and I love to talk about programming as well as writing technical tutorials and tips that can help to others.

Get connected with me. :) LinkedIn Twitter Instagram Facebook