Python – Create Static Method From Function – staticmethod() Function with Examples

staticmethod() function is used to find the a static method for a given function in Python for the given input.

staticmethod() function is a part of Python Built-in Functions.

Syntax of staticmethod() Function

The syntax of staticmethod() function in Python is:

staticmethod(function)

 

Parameters of staticmethod() Function in Python

x – Where x is any valid . This parameter is required.

 

Compatibility

staticmethod() function is available and compatible with both Python 2.x and 3.x.

 

Return Value of staticmethod() Function in Python

staticmethod() function returns a static method for a given function for the given input.

 

Python staticmethod() Function Example 1

Example CODE

Output:

 

Python staticmethod() Function Example 2

Example CODE

Output: