03 2020 档案

摘要:1、把登录与注册的密码都换成密文形式 import hashlib def register(): m = hashlib.md5() username = input("请输入要注册的账号:") password = input("请输入要注册的密码:") password2 = input("请 阅读全文
posted @ 2020-03-31 19:36 小小码农梦还家 阅读(177) 评论(0) 推荐(0)
摘要:configparser import configparser config = configparser.ConfigParser() config.read('test.ini') import configparser config = configparser.ConfigParser() 阅读全文
posted @ 2020-03-31 19:32 小小码农梦还家 阅读(137) 评论(0) 推荐(0)
摘要:# 1、检索文件夹大小的程序,要求执行方式如下# python3.8 run.py 文件夹 import os path=sys.argv[1] size= 0 for line in os.listdir(path): path2 = os.path.join(path, line) if os. 阅读全文
posted @ 2020-03-30 21:03 小小码农梦还家 阅读(154) 评论(0) 推荐(0)
摘要:start: from core import srcimport osimport sys#将项目根目录添加到sys.path中 即添加环境变量?dir = os.path.dirname(os.path.dirname(__file__))sys.path.append(dir)if __nam 阅读全文
posted @ 2020-03-29 21:38 小小码农梦还家 阅读(145) 评论(0) 推荐(0)
摘要:作业:1、文件内容如下,标题为:姓名,性别,年纪,薪资 egon male 18 3000 alex male 38 30000 wupeiqi female 28 20000 yuanhao female 28 10000要求:从文件中取出每一条记录放入列表中,列表的每个元素都是{'name':' 阅读全文
posted @ 2020-03-26 20:51 小小码农梦还家 阅读(111) 评论(0) 推荐(0)
摘要:1、文件内容如下,标题为:姓名,性别,年纪,薪资egon male 18 3000alex male 38 30000wupeiqi female 28 20000yuanhao female 28 10000要求:从文件中取出每一条记录放入列表中,列表的每个元素都是{'name':'egon',' 阅读全文
posted @ 2020-03-25 20:05 小小码农梦还家 阅读(103) 评论(0) 推荐(0)
摘要:作业:1、编写课上讲解的有参装饰器准备明天默写 def auth(db_type = 'file'): def inner(func): def wrapper(*args, **kwargs): inp_name = input("your name:").strip() inp_pwd = in 阅读全文
posted @ 2020-03-24 19:16 小小码农梦还家 阅读(103) 评论(0) 推荐(0)
摘要:一:编写函数,(函数执行的时间用time.sleep(n)模拟) def timer(): start_time = time.time() time.sleep(3) stop_time = time.time() use_time = stop_time - start_time print(u 阅读全文
posted @ 2020-03-23 19:55 小小码农梦还家 阅读(108) 评论(0) 推荐(0)
摘要:今日作业: 1、函数对象优化多分支if的代码练熟 def login(): print("登录功能")def register(): print("注册功能")def transfer_accounts(): print("转账功能")def check_banlance(): print("查询功 阅读全文
posted @ 2020-03-20 21:35 小小码农梦还家 阅读(97) 评论(0) 推荐(0)
摘要:# 作业要求:下述所有代码画图以及分析代码执行流程# 1、以定义阶段为准,先画出名称空间的嵌套关系图# 2、然后找到调用函数的位置,写出函数调用时代码的执行过程,涉及到名字的查找时,参照1中画好# 的嵌套图,标明查找顺序,一层一层直到找到位置# 题目一 input=333def func(): in 阅读全文
posted @ 2020-03-19 19:14 小小码农梦还家 阅读(144) 评论(0) 推荐(0)
摘要:1、写函数,,用户传入修改的文件名,与要修改的内容,执行函数,完成批了修改操作list=()def file{file_path,old,new} with open('user.txt','r',encoding='utf-8')as f: line=f.read() with open('use 阅读全文
posted @ 2020-03-18 19:45 小小码农梦还家 阅读(151) 评论(0) 推荐(0)
摘要:# 1、编写文件修改功能,调用函数时,传入三个参数(修改的文件路径,要修改的内容,修改后的内容)既可完成文件的修改def file(path,old,new): with open(path, mode='rt', encoding='utf-8') as f: data = f.read() wi 阅读全文
posted @ 2020-03-17 19:28 小小码农梦还家 阅读(136) 评论(0) 推荐(0)
摘要:#一:今日作业:#1、编写文件copy工具file_1=input('请输入复制文件路径:')file_2=input('请输入粘贴文件路径:')with open(r'{}'.format(file_1),mode='rt',encoding='utf-8') as f1,open(r'{}'.f 阅读全文
posted @ 2020-03-13 17:20 小小码农梦还家 阅读(125) 评论(0) 推荐(0)
摘要:# 1、有列表['alex',49,[1900,3,18]],分别取出列表中的名字,年龄,出生的年,月,日赋值给不同的变量# l=['alex',49,[1900,3,18]]# name=l[0]# age=l[1]# year=l[2][0]# month=l[2][1]# month=l[2] 阅读全文
posted @ 2020-03-11 19:12 小小码农梦还家 阅读(407) 评论(0) 推荐(0)