Python class Keyword
Definition and Usage
The class
keyword is used to create a class.
A class is like an object constructor. See the example below to see how we can use it to create an object.
More Examples
Example
Create an object named p1, using the class from the example above:
p1 = Person()
print(p1.name)
Try it Yourself »
Related Pages
Read more about classes and objects in our Python Classes/Objects Tutorial.
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.