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('两次密码不一致')










  • 相关阅读:
    html 锚点
    html table 表格详解
    IE6 不识别css固定元素位置(fixed)属性
    css hack 方法总汇2
    css hack 方法总汇1
    JS刷新父窗口的几种方式
    手动切换选项卡
    自动切换选项卡
    jquery 判断 radio,checkbox,select是否被选中
    EasyUI 各种json数据格式
  • 原文地址:https://www.cnblogs.com/chenyoupan/p/12513389.html
Copyright © 2011-2022 走看看