访问修改属性日志
1 import time as t
2
3 class Record:
4 def __init__(self,value= None,name = None):
5 self.value = value
6 self.name = name
7
8 def __get__(self,instance,owner):
9 with open('D://record.txt','a') as f:
10 f.write('%s變量于北京時間%s被讀取,%s = %d'%\
11 (self.name,t.ctime(),self.name,self.value)
12
13 return self.value
14
15 def __set__(self,instance,value):
16 self.value = value
17 with open('D://record.txt','a') as f:
18 f.write('%s變量于北京時間%s被修改,%s = %d'%\
19 (self.name,t.ctime(),self.name,self.value)
20
21
22 class Test:
23 x = Record(10,'x')
24 y = Record(8,'y')
?
轉(zhuǎn)載于:https://www.cnblogs.com/themost/p/6528848.html
總結(jié)
- 上一篇: DDR等布线/走线需要等长的原因
- 下一篇: 3、jeecg 笔记之 模糊查询