python代码:
#!/usr/bin/python
#-*- coding:utf-8 -*-
import os
import sys
import datetime
import re
def isAscii(ch) :
return ch <= u'\u007f'
def formatByWidth(text, width, align_left=True) :
pad = " " * (width - strlen(text))
if align_left :
return text + pad
else :
return pad + text
def strlen(str) :
count = len(str)
for u in str:
if not isAscii(u) :
count += 1
return count
#return directory total size, unit K
def getDirSize(dir) :

本文介绍了一个Python脚本,该脚本可以模拟Linux的ls命令,在Windows命令行中显示当前目录或指定目录下所有文件的大小、最后修改日期。通过pyinstaller打包成exe文件后,可以方便地在命令行中使用。
最低0.47元/天 解锁文章
36

被折叠的 条评论
为什么被折叠?



