2026/4/18 17:26:21
网站建设
项目流程
北京市建设工程招标网站,宠物商品销售网站开发背景,wordpress 所有过滤器,高平网站优化公司1.使用os和os.path以及函数的递归完成:给出一个路径#xff0c;遍历当前路径所有的文件及文件夹打印输出所有的文件#xff08;遇到文件输出路径#xff0c;遇到文件夹继续进文件夹#xff09;2.使用加密模块及IO模拟登录功能#xff0c;要求使用文件模… 1.使用os和os.path以及函数的递归完成: 给出一个路径遍历当前路径所有的文件及文件夹 打印输出所有的文件遇到文件输出路径遇到文件夹继续进文件夹 2.使用加密模块及IO模拟登录功能要求使用文件模拟数据库存储用户名和密码。 import os import os.path as path file_path_folder D:\\Vscode-Python\\code-py\\python2\\09_package\\test_module def for_file(path1): for file in os.listdir(path1): path2 path.join(path1,file) if path.isfile(path2): print(f文件名,{path2}) elif path.isdir(path2): for_file(path2) for_file(file_path_folder) import hashlib def encrytion(str): slat !!## res hashlib.md5(str.encode(utf-8)) res.update(slat.encode(utf-8)) return res.hexdigest() f open(作业/3/a.txt,mode w) f.write(zhangsan) g open(作业/3/b.txt,mode w) g.write(123) fencrytion(zhangsan) gencrytion(123) #模拟登录过程 username input(username:) password input(password:) def login(username,password): return True if encrytion(username) f and encrytion(password) g else False print(登录成功if login(username,password) else 登录失败)