Define a class : Class Definition « Class « Python
- Python
- Class
- Class Definition
Define a class
class MyClass:
"A simple example class"
i = 12345
def f(self):
return 'hello world'
#__doc__ is also a valid attribute, returning the docstring belonging to the class:
#"A simple example class".
Related examples in the same category