Windows下Python获取磁盘空闲空间并写入日志,python空闲,from ctypes
文章由Byrx.net分享于2019-03-23 05:03:13
Windows下Python获取磁盘空闲空间并写入日志,python空闲,from ctypes
from ctypes import *import timeimport win32filerun = Truelogfile = open('.\\log.out','w+');#open log fileinput = raw_input("Input a string for disk name like \'d:\' or other:")#input a disk namewhile run: sectorsPerCluster, bytesPerSector, numFreeClusters, totalNumClusters = \ win32file.GetDiskFreeSpace(input) freespace = (numFreeClusters * sectorsPerCluster * bytesPerSector) /(1024 * 1024)#get free space logfile.write("%s %s FreeSpace is %d MBytes\n" % (time.asctime(),input,freespace));#write log print time.asctime(),input,"FreeSpace is",freespace,"MBytes"#output to screen time.sleep(3)#wait 3 secondlogfile.close();#close log file
相关内容
- monkeyrunner 代码示例,monkeyrunner示例,'''from com.
- python获取本机网卡的mac地址,python获取网卡mac,python获取
- programming python 之tkinter初学,pythontkinter,#!/usr/bin/e
- 基本字符串压缩,字符串压缩,class Zipper
- python编写小程序(计算器),python小程序,#coding=gbkd
- 有两个文件,一个存储学号,姓名,另一个存储学号,
- python实现堆排序,python堆排序,#沿左,右子节点较大者依
- Python 计算已经过去多少个周末,python已经过去,计算已
- 一列文本转成三列,一列文本三列,"""一列文本进行
- python批量生成本地ip地址,python生成ip,这段代码用于在
评论关闭