猫史档案馆


【Python作品分享】新的作品

用户:急躁的乌力力wXiI急躁的乌力力wXiI查看:0 回复:0 评论:0 创建时间:2023-01-05T09:52:59


【作品展示】

center_image

 

【作品介绍】

这个系统可做一个门禁,但加密部分有待提高。而且运行起来需要在电脑的D盘中设一个名为‘python(登录)’的文本文档。

 

【作品源代码】

#导入库
import turtle  as t
import time as ti
#开始图案
t.ht()
t.pensize(4)
t.speed(10)
t.pencolor('white')
t.bgcolor('black')
t.title('注册系统')
t.setheading(180)
for i in range(10):
    for i in range(5):
        t.fd(100)
        t.left(72)
    t.left(36)
#系统
while True:
    print('欢迎使用注册登录系统')
    ans = t.textinput('注册登录系统', '请问您是登录还是注册?')
    if ans == '登录':
        ansername = t.textinput('登录注册系统', '请输入姓名')
        anserpnumb = t.textinput('登录注册系统', '请输入电话号码')
        ansernumb = t.textinput('登录注册系统', '请输入密码')
        g = 'ansername:{},anserpnumb:{},ansernumb:{}'.format(
            ansername, anserpnumb, ansernumb)
        with open('D:/python(登录).txt','r',encoding='utf-8')as f:
            t=f.readlines()
        if g in t:
            ti.sleep(5)
            print('登陆成功')
            break
        else:
            ti.sleep(5)
            print('登录失败,用户名、电话号码或密码错误,请重试')
            break
    elif ans=='注册':
        try:
            ansername=t.textinput('太阳家注册系统','请输入姓名')
            anserpnumb=t.textinput('太阳家注册系统','请输入电话号码')
            while True:
                ansernumb=t.textinput('太阳家注册系统','请输入密码')
                if len(ansernumb) >= 6:
                    break
                else:
                    print('密码位数必须≥6')
                    continue
                
                with open('D:/python(登录).txt','r',encoding='utf-8')as f:
                    f.readlines()
                
            with open('D:/python(登录).txt','a',encoding='utf-8')as t:
               b=t.write('\n'+g)
            ti.sleep(5)   
            print('注册成功')
            break
    else:
        print('请重新输入')
        continue
#错误机制
        except:
            ti.sleep(5)
            print('系统注册失败,请重试')
            
    
    
    

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页