deleted_time = parse_windows_filetime(raw_deleted_time[0]) file_path = raw_file_path.decode("utf16").strip("\x00")return{'file_size': file_size,'file_path': file_path,'deleted_time': deleted_time} 我们的sizeof_fmt()函数是从StackOverflow.com借来的,这是一个充满了许多编程问题解决方案...
socket.SOCK_STREAM)ass:s.connect((ip_address,8080))s.sendall(b'GET /boot_time HTTP/1.1\r\n\r\n')data=s.recv(1024)boot_time=data.decode('utf-8')returnboot_timeexceptsocket.errorase:returnstr(e)ip_address='192.168.1.1'boot_time=get_boot_time(ip_address)print(f'Computer at{ip_addre...
我们使用os.path.getctime()方法收集相应的 Windows 创建时间,并使用datetime.fromtimestamp()方法将整数值转换为日期。有了我们的datetime对象准备好了,我们可以通过使用指定的timezone使值具有时区意识,并在将时间戳打印到控制台之前将其提供给pywintype.Time()函数: created = dt.fromtimestamp(os.path.getctime(...
很早就打算学python了,但后来各种事情太多就又耽搁了(主要是太会摸鱼了)。这学期开了python课,就打算继续开始学习,先快速学习一下python的基础语法,后续有机会还会学习python比较厉害的爬虫、数据分析、数据可视化等。感觉学习一门语言,及时的记录是很重要的,不仅可以加深印象也方便以后的查阅,本篇博客记录的是python中...
data = get_my_computer()re = json.dumps(data)print(data) JSON输出数据 {'sys': {'hostname': 'poleung-len', 'ip': '192.168.4.16', 'mac': '4c:79:6e:4f:ff:0f', 'user': 'poleung', 'start_time': '2023-01-24 08:18:44'}, 'cpu': {'amount': 8, 'rate': '32.8%'},...
importtimeimportthreading deffunc(n):print("current task:",n)time.sleep(1)if__name__=="__main__":t=time.time()t1=threading.Thread(target=func,args=("thread 1",))t2=threading.Thread(target=func,args=("thread 2",))t1.start()t2.start()# 加入主线程 ...
data = get_my_computer() re = json.dumps(data) print(data) 1. 2. 3. JSON输出数据 {'sys': {'hostname': 'poleung-len', 'ip': '192.168.4.16', 'mac': '4c:79:6e:4f:ff:0f', 'user': 'poleung', 'start_time': '2023-01-24 08:18:44'}, 'cpu': {'amount': 8, 'rate...
spec = Computer() spec.GPUEnabled = True spec.CPUEnabled = True spec.Open() # Get CPU Temp def Cpu_Temp(): while True: for cpu in range(0, len(spec.Hardware[0].Sensors)): if "/temperature" in str(spec.Hardware[0].Sensors[cpu].Identifier): ...
response = requests.get(url) res = json.loads(response.text) # res_2 = res.decode('utf-8') yan_shangju = res['newslist'][0]['front'] yan_xiaju = res['newslist'][0]['behind'] 生活指数: 生活指数 url = 'https://api.jisuapi.com/weather/query?appkey=你的密钥&city=沈阳' ...
# -*- coding: utf-8 -*-# @File : demo.py# @author: Flyme awei# @email : 1071505897@qq.com# @Time : 2022/8/2 13:40# 单行注释'''多行注释'''"""多行注释""" 2.1.3 续行符 Python程序是逐行编写的,每行代码长度并无限制,但从程序员角度,单行代码太长并不利于阅读。这个时候...