Python class keyword

Instance

Create a class named "Person":

class Person:
  name = "Bill"
  age = 63

Run Instance

Definition and Usage

The 'class' keyword is used to create classes.

Classes are like object constructors. See the following example to understand how to use classes to create objects.

More Examples

Instance

Create object p1 using the class in the above example:

p1 = Person()
print(p1.name)

Run Instance

related pages

Please see our Python Class/Object Tutorial More about classes and objects in middle school.