passwd = hashlib.sha256(password + config.passwd_hash_key).hexdigest()
# (st_mtime=1330498089, st_ctime=1330498089)#文件最后访问时间
result = [(i, os.stat(DIR + i).st_mtime) for i in os.listdir(DIR)]
# 安最后访问排序,遍历,目前只有一个元祖列表
for i in sorted(result, key=lambda x: x[1]):
info_data['time'] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
效果一样
time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
输出过去的某一个时间,也可以未来的某一个时间
def old_time(delday=0, min=0):
today = datetime.datetime.now()
old_day = (today - datetime.timedelta(days=delday, minutes=min)).strftime("%Y-%m-%d %H:%M")
return old_day
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
for fpathe, dirs, fs in os.walk(conf_dir):
list_ff = []
ff = fpathe.split('/opt/blueix/conf/')[1]
for f in fs:
if '.properties' in f:
file_path = os.path.join(fpathe, f)
# 获取文件创建时间
ctime = time.ctime(os.path.getmtime(file_path), )
# 返回时间元祖
timeArray = time.strptime(ctime, '%a %b %d %H:%M:%S %Y')
last_ctime = time.strftime("%Y%m%d %H:%M:%S", timeArray)
list_f = [ff, f, file_path, last_ctime]
list_ff.append(list_f)
if list_ff != []:
dict[ff] = list_ff
return dict
# 先转化为本地时间再格式化输出
date = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
$("button").click(function(){
var con = $("textarea").val();
if(conn === con){
alert("数据一样")
return
}
try
{
JSON.parse(con);
}
catch(err) {
alert("输入的格式要为json")
return
}
$.ajax({
url:"/xx/?dir=a",
type:"POST",
data: con,
contentType: "application/text",
dataType: "json",
success: function (data){
if(data.code===200){
// location.assign('/suc')
$("textarea").hide();
$("button").hide();
$("<p></p>").html(data.msg).appendTo($("body"))
}
}
})
sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "..")))
浙公网安备 33010602011771号