반응형
class BusinessCard:
def set_info(self, name, email, addr):
self.name = name
self.email = email
self.addr = addr
def show_info(self):
print('-'*30)
print('Name: ', self.name)
print('E-mail: ', self.email)
print('Address: ', self.addr)
print('-'*30)
val = BusinessCard()
val.set_info('JohnMark','practice1356@gmail.com','Seoul Mapo')
print(val)
print()
val.show_info()
실행결과
$ py basic.py
<__main__.BusinessCard object at 0x00F4A190>
------------------------------
Name: JohnMark
E-mail: practice1356@gmail.com
Address: Seoul Mapo
------------------------------
반응형
'Programming > Python' 카테고리의 다른 글
[Python-Basic] Class Data Type - 3(Constructor) (0) | 2019.11.05 |
---|---|
[Python-Basic] Class Data Type - 2(Instance) (0) | 2019.11.05 |
[Python-Basic] Tuple Data Type - 1 (0) | 2019.11.05 |
[Python-Basic] Tuple Data Type - 2 (Index) (0) | 2019.11.05 |
[Python-Basic] List Data Type - 5 (Slicing) (0) | 2019.11.05 |