1 parent bc913a1 commit 86ab9f2Copy full SHA for 86ab9f2
1 file changed
classes.md
@@ -37,6 +37,20 @@ string.
37
>>>
38
```
39
40
+We can also get an instance's class with `type()`:
41
+
42
+```py
43
+>>> type('')
44
+<class 'str'>
45
+>>> type(0)
46
+<class 'int'>
47
+>>> type([])
48
+<class 'list'>
49
+>>> type({})
50
+<class 'dict'>
51
+>>>
52
+```
53
54
Let's say you make a program that processes data about websites. With a
55
custom class, you're not limited to `str`, `int` and other classes
56
Python comes with. Instead you can define a Website class, and make
0 commit comments