1、使用python3执行程序.按提示输入1或2,登录或退出程序 2、输入用户名后,如果用户名被锁定及无效用户名,程序会退出,请确保输入正确. 3、输入用户名正确后,输入密码.用户名正确的情况下,密码连续输错三次,用户将被锁定,禁止登录系统
用字典比用list 好些 list_user={} cmd=raw_input('输入命令 1 注册 2登录 3 退出:') ##print 'cmd:',cmd,cmd <>3,type(cmd) cmd = int(cmd) while (cmd <>3): if cmd==1: while true: l = raw_input('输入注册账号和密码 用空格分开:') user=l.split(' ')[
import MySQLdb conn=MySQLdb.connect(user='root',passwd='pwd',host='127.0.0.1',db='python_test') cur=conn.cursor() cur.execute("select * from users where uid='101' and login='ong'")##uid 是你的密码 ;login是你的用户名 num=0 for data in
users = {'root': ['123', False], 'westos': ['456', False]}while True: if all([x[1] for x in users.values()]): print('two users login successfully') break user = input('input user name:\t') if not users.get(user): print('unexist user') continue else: for i in range(3): pw =
# -*- coding: utf-8 -*- errortimes=0 while errortimes<3: user=raw_input("user:") password=raw_input("password:") if user=='123' and password=='456': #正确后允许进入并退出循环 print "enter" break else: #错误时,出错计数加1 print "
根据你的前提:dim con as new adodb.connection '声明一个数据连接对象变量,用于打开数据库 dim rs as new adodb.recordset '声明一个数据集对象变量,用于打开数据表 private sub form_load() '在窗体加载事件中,打开数据连接对象 con.
name=input('请输入用户名:') while True: #name=input('请输入用户名:') if name=='1': while True: try: powerword=eval(input('请输入密码:')) if powerword==123456: name=100 break else: print('密码不正确,请重新输入:') except: print('密码不正确,请重新输入:') elif name==100: break else: print('用户名不正确,请重新输入:') name=input('请输入用户名:') print('欢迎回来')
你要抓包,看那个网站提交的方式,和参数,然后在你的代码里面添加变量,在访问请求里面将用户名和密码添加,然后提交就行了
import httplib2response, content = httplib2.Http().request( "guji.artx.cn", "GET" header={"cookie":"bdshare_", "User-Agent":"Mozilla/5.0 (Windows"}请求头都以dict形式写在header里就行了.返回值中,response里主要是状态码,等信息,注意里面的set-cookie字段.所以除了js无法实现,你完全可以100%模拟浏览器的行为,cookie、ua、referer都可以带上.
python2中用raw_input() python3中用input() 如果想通过参数的方式获取用sys.argv()