Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- import sqlite3 as db
- #проверка на существующего пользователя и пароль
- print ('input reg for reg or enter your name')
- conn = db.connect('players.db')
- c = conn.cursor()
- _id = input('')
- if _id != 'reg' or 'REG':
- player_ex = c.execute("SELECT login FROM users WHERE login=?", (_id,))
- count = c.fetchone()
- print (count)
- while _id not in(count):
- print ("имя не существует, выбери другое: ")
- _id=input()
- else:
- print ('hello, ', _id)
- c.execute("SELECT password FROM users WHERE users.login=?", (_id,))
- expwd = c.fetchone()
- password_exist=input('enter your password')
- while password_exist not in (expwd):
- print ("Password is incorrect. Please type again:")
- password_exist=input('')
- else:
- print("welcome back!")
- если пользователь существует:
- [sava@sava-pc mypr]$ python main.py
- input reg for reg or enter your name
- sava
- ('sava',)
- hello sava
- enter your password
- Password is incorrect. Please type again:
- 123
- welcome back!
- [('sava', '123'), ('qwerty', '1'), (None, None)]
- Чтобы узнать базовые характеристики персонажа
- введи его название на английском: warrior или archer, или wizard или stop,
- чтобы перейти к выбору персонажа. Нажми ENTER ^Z
- [28]+ Stopped python main.py
- если пользователь не существует:
- [sava@sava-pc mypr]$ python main.py
- input reg for reg or enter your name
- ert
- None
- Traceback (most recent call last):
- File "main.py", line 15, in <module>
- while _id not in(count):
- TypeError: argument of type 'NoneType' is not iterable
- [sava@sava-pc mypr]$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement