1、logging模块有几个日志级别?
2、请配置logging模块,使其在屏幕和文件里同时打印以下格式的日志
2017-10-18 15:56:26,613 - access - ERROR - account [1234] too many login attempts
3、json、pickle、shelve三个区别是什么?
4、json的作用是什么?
5、subprocess执行命令方法有几种?
6、为什么要设计好目录结构?
7、打印出命令行的第一个参数。例如:

8、代码如下:

(1)打印的内容是什么?
(2)os.path.dirname和os.path.abspath含义是什么?
9、通过configparser模块完成以下功能
文件名my.cnf

(1)修改时区 default-time-zone = '+8:00' 为 校准的全球时间 +00:00
(2)删除 explicit_defaults_for_timestamp = true
(3)为DEFAULT增加一条 character-set-server = utf8
10、写一个6位随机验证码程序(使用random模块),要求验证码中至少包含一个数字、一个小写字母、一个大写字母.
11、利用正则表达式提取到 luffycity.com ,内容如下

12、写一个用户登录验证程序,文件如下
1234.json
{"expire_date":"2021-01-01","id": 1234,"status": 0,"pay_day": 22,"password":"abc"}
(1)用户名为json文件名,密码为 password。
(2)判断是否过期,与expire_date进行对比。
(3)登陆成功后,打印“登陆成功”,三次登陆失败,status值改为1,并且锁定账号。
13、把第12题三次验证的密码进行hashlib加密处理。即:json文件保存为md5的值,然后用md5的值进行验证。
14、最近luffy买了个tesla,通过转账的形式,并且支付了5%的手续费,tesla价格为75万。文件为json,请用程序实现该转账行为。
目录结构为

当执行start.py时,出现交互窗口

需求如下:
选择1 账户信息 显示luffy的当前账户余额和信用额度。
选择2 提现 提现金额应小于等于信用额度,利息为5%,提现金额为用户自定义。
16、尝试把上一章的验证用户登陆的装饰器添加到提现和转账的功能上。
17、对第15题的用户转账、登录、提现操作均通过logging模块记录日志,日志文件位置如下

综合作业:
模拟实现一个ATM + 购物商城程序

流程图参考:

网友评论