pythonUtils
import hashlib
def encryption(password):
"""登录加密"""
# 1.创建一个hash对象
h = hashlib.sha256()
h.update(bytes(password))
# 3.获取加密结果
pawd_result = h.hexdigest()
return pawd_result
#python的各种加密在这个模块下都有
删除文件夹下的指定文件
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
def del_files(path):
for root , dirs, files in os.walk(path):
for name in files:
if name.endswith(".tmp"):
os.remove(os.path.join(root, name))
print ("Delete File: " + os.path.join(root, name))
# test
if __name__ == "__main__":
path = '/tmp'
del_files(path)