{"id":24809,"date":"2021-11-02T09:48:11","date_gmt":"2021-11-02T04:18:11","guid":{"rendered":"https:\/\/python-programs.com\/?p=24809"},"modified":"2021-11-05T20:37:24","modified_gmt":"2021-11-05T15:07:24","slug":"python-hasattr-method-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-hasattr-method-with-examples\/","title":{"rendered":"Python hasattr() Method with Examples"},"content":{"rendered":"

In the previous article, we have discussed Python globals() Function with Examples<\/a>
\nhasattr() Method in Python:<\/strong><\/p>\n

If the specified object has the specified attribute, the hasattr() function returns true; otherwise, it returns False.<\/p>\n

Syntax:<\/strong><\/p>\n

hasattr(object, attribute)<\/pre>\n

Parameter Values<\/strong><\/p>\n

object:<\/strong> This is required. It is an object.<\/p>\n

attribute:<\/strong> The name of the attribute to be checked whether exists or not.<\/p>\n

Return Value:<\/strong><\/p>\n

The method hasattr() returns:<\/p>\n