classPerson: """ 사람을 표현하는 클래스 Attributes ------------ name : str name of the person age : int age of the person Methods ------------- info(additional=""): prints the person's name and age """ def__init__(self, name, age): """ Constructs all the neccessary attributes for the person object Parameters(매개변수) ------------------------- name : str name of the person age : int age of the person """
self.name = name self.age = age
definfo(self, additional = None): """ 귀찮음... Parameters -------------- additional : str, optional more info to be displayed (Default is None) / A, B, C Returens ----------- None """
print(f'My name is {self.name}. I am {self.age} years old. ' + additional)
if __name__ == "__main__": person = Person("Evan", age = 20) person.info("나의 직장은 00이야") help(Person)
My name is Evan. I am 20 years old. 나의 직장은 00이야
Help on class Person in module __main__:
class Person(builtins.object)
| Person(name, age)
|
| 사람을 표현하는 클래스
|
|
|
| Attributes
| ------------
| name : str
| name of the person
|
| age : int
| age of the person
|
| Methods
| -------------
|
| info(additional=""):
| prints the person's name and age
|
| Methods defined here:
|
| __init__(self, name, age)
| Constructs all the neccessary attributes for the person object
|
| Parameters(매개변수)
| -------------------------
| name : str
| name of the person
|
| age : int
| age of the person
|
| info(self, additional=None)
| 귀찮음...
|
| Parameters
| --------------
| additional : str, optional
| more info to be displayed (Default is None) / A, B, C
|
|
| Returens
| -----------
| None
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)