• 3.13作业


    1、编写文件copy工具

    src_file=input('源文件路径>>: ').strip()
    dst_file=input('源文件路径>>: ').strip()
    with open(r'{}'.format(src_file),mode='rt',encoding='utf-8') as f1,
        open(r'{}'.format(dst_file),mode='wt',encoding='utf-8') as f2:
        res=f1.read()
        f2.write(res)
    

    2、编写登录程序,账号密码来自于文件

    inp_name=input('your name:').strip()
    inp_pwd=input('your pwd:').strip()
    with open(r'users.txt',mode='rt',encoding='utf-8') as f:
        for i in f:
            username,password=i.strip().split(':')
            if inp_name == username and inp_pwd == password:
                print('登录成功')
                break
        else:
            print('用户名或密码错误')
    

    3、编写注册程序,账号密码来存入文件

    name=input('your name>>: ')
    pwd=input('your name>>: ')
    with open(r'users1.txt',mode='at',encoding='utf-8') as f:
        f.write('{}:{}
    '.format(name,pwd))
    
  • 相关阅读:
    Postfix邮件
    RAID和LVM磁盘阵列
    CF1400G
    CF1400F
    2020 AC Saber夏季赛 游记
    APIO2018 题解
    2020北京中考游记
    初中数学几何推理大梳理
    CF1373F Network Coverage
    部编人教版初中历史书事件影响/意义汇总
  • 原文地址:https://www.cnblogs.com/linqiaobao/p/12489692.html
Copyright © 2020-2023  润新知