1分で学ぶPython|delattr()の使い方

HomeFunctions

delattr()の例1

Delete the "age" property from the "person" object:

class Person:
  name = "John"  
  age = 36  
  country = "Norway"

delattr(Person, 'age')

delattr()の定義及び使い方

The delattr() function will delete the specified attribute from the specified object.

delattr()の構文

    delattr(object, attribute)

delattr()の引数

オブジェクト:必須。オブジェクト。

属性:必須。削除する属性の名前

HomeFunctions

Last Updated: 7/27/2019, 11:23:37 AM