Python Create Object
Create Object
Now we can use the class named myClass to create objects:
Example
Create an object named p1, and print the value of x:
p1 = MyClass()
print(p1.x)
Try it Yourself »
Now we can use the class named myClass to create objects:
Create an object named p1, and print the value of x:
p1 = MyClass()
print(p1.x)
Try it Yourself »
If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com
If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com