-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_class_1.py
More file actions
39 lines (29 loc) · 900 Bytes
/
python_class_1.py
File metadata and controls
39 lines (29 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
import io
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')
class UserInfo:
def __init__(self, name, phone):
#def set_info(self, name, phone):
self.name = name
self.phone = phone
def print_info(self):
print("--------------------------")
print("Name : " + self.name)
print("Phone : " + self.phone)
print("--------------------------")
def __del__(self):
print("delete!")
user1 = UserInfo("kim","010-1234-1234")
user2 = UserInfo("park","010-5678-5678")
#user1 = UserInfo()
#user2 = UserInfo()
print(id(user1))
print(id(user2))
#user1.set_info("kim","010-1234-1234")
#user2.set_info("park","010-5678-5678")
user1.print_info()
user2.print_info()
print(user1.__dict__)
print(user2.__dict__)
print(user1.name,user1.phone)