zoukankan      html  css  js  c++  java
  • 3.17作业

    # 1、编写文件修改功能,调用函数时,传入三个参数(修改的文件路径,要修改的内容,修改后的内容)既可完成文件的修改
    # def fc (file,x,y):
    # with open(r'{}'.format(file),mode='rt',encoding="utf=-8")as f:
    # res=f.read()
    # data=res.replace(x,y)
    # with open(r'{}'.format(file),mode='wt',encoding="utf=-8")as f1:
    # f1.write(data)

    # 2、编写tail工具
    # def tail()
    # import time
    # with open('a.txt', mode='rb') as f:
    # f.seek(0,2)
    # while True:
    # line=f.readline()
    # if len(line) == 0:
    # time.sleep(0.3)
    # else:
    # print(line.decode('utf-8'),end='')



    # 3、编写登录功能
    # def login()
    # while True:
    # inp_name=input('请输入用户名:')
    # inp_pwd=input('请输入密码:')
    # with open('user.txt','r',encoding='utf-8')as f:
    # for line in f:
    # username,password=line.strip().split(':')
    # if inp_pwd==username and inp_pwd==password:
    # print('登陆成功')
    # break
    # else:
    # print('登录失败')

    # 4、编写注册功能
    # def enrol()
    # res={}
    # while True:
    # with open('user.txt','r',encoding='utf-8')as f:
    # for line in f:
    # username,password=line.strip().split(':')
    # res[username]=password
    # while True:
    # inp_name = input('请输入用户名:')
    # if inp_name in res:
    # print('用户已存在')
    # continue
    # inp_pwd = input('请输入密码:')
    # re_inp_pwd = input('请输入密码:')
    # if inp_pwd==re_inp_pwd:
    # print('注册成功')
    # with open('user.txt','a',encoding='utf-8')as f2:
    # f2.write('{}:{} '.format(inp_name,inp_pwd))
    # break
    # else:
    # print('两次密码不一致')










  • 相关阅读:
    MySQL数据库表的设计和优化(上)
    MySQL性能优化最佳实践20条
    MySQL高性能优化指导思路
    MySQL 5.6 my.cnf优化后的标准配置(4核 16G Centos6.5 x64)
    MySQL优化之索引优化
    MySQL优化之SQL语句优化
    MySQL优化之配置参数调优
    Apache的ab测试
    FastCGI模式下安装Xcache
    除了用作缓存数据,Redis还可以做这些
  • 原文地址:https://www.cnblogs.com/chenyoupan/p/12513389.html
Copyright © 2011-2022 走看看