标签:blog os for 文件 div cti log on c
#coding:utf8
import os,time
directory = "d:/scrapy tutorial/"
t = []
d = {}
for filename in os.listdir(directory):
path = directory + filename
time1 = time.ctime(os.path.getmtime(path))
d[time1] = filename
t.append(time1)
n = 1
for i in sorted(t):
fn = directory + d[i]
new_fn = directory + str(n) + ‘. ‘ + d[i]
## if n<10:
## new_fn = directory + d[i][1:]
## else:
## new_fn = directory + d[i][2:]
os.rename(fn, new_fn)
n += 1
临时写的一个脚本,可以用在那些不支持按时间排序、默认按[0-9a-Z]排序的系统上
标签:blog os for 文件 div cti log on c
原文地址:http://www.cnblogs.com/bushe/p/3969137.html