This article is an experience story that I, who is not good at searching, said "What is this?"
attribute error
AttributeError: module(object) ‘xxx’ has no attribute ‘yyy’
You may get an error like this ..
class Person:
def __init__(self, name:str, age:int):
self.name = name
self.age = age
def renamed(person, pserson2):
person.name = 'Kein'
return person, ron
bob = Person('Bob', 19)
ron = Person('Ron', 23)
kein = renamed(bob, ron)
print(kein.name)
print(kein.age)
print(ron.name)
print(ron.age)
The number of variables to put in like this was different ...
class Person:
def __init__(self, name:str, age:int):
self.name = name
self.age = age
def renamed(person, pserson2):
person.name = 'Kein'
return person, ron
bob = Person('Bob', 19)
ron = Person('Ron', 23)
kein, ron = renamed(bob, ron)
print(kein.name)
print(kein.age)
print(ron.name)
print(ron.age)
I was trying to put in the return price properly,
As you can see from your own code, if you try to deal with it with an error message, you may struggle without knowledge. I want to write highly readable code
Recommended Posts