---
# System prepended metadata

title: 檢查類別成員是否存在
tags: [語法相關]

---

檢查類別成員是否存在
===


`hasattr(類別實例, 類別成員名稱)`


## Ref.
[How to check if an attribute exists in an object in Python](https://www.kite.com/python/answers/how-to-check-if-an-attribute-exists-in-an-object-in-python)

###### tags: `語法相關`