Ⅰ python如何實現讀取excel中賬號密碼後自動登錄網頁並實現固定操作
這個有工作量的,需要比較多的調試時間。
另外程序也不能通用,個別步驟是需要針對網站進行適配
Ⅱ python模擬用戶登錄系統,如何兩個用戶輸入各自的密碼才能登入
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: ')
if not users.get(user):
print('unexist user')
continue
else:
for i in range(3):
pw = input('input password: ')
if users[user][0] == pw:
print(f'user `{user}` login successfully')
users[user][1] = True
break
用一個字典存儲username,pw以及登錄狀態. 10行判斷是否兩個人登錄狀態都為True,如果是,則列印並退出while. 否則13行輸入username,如果name不存在,while continue; 如果存在, 進入else,輸入密碼,密碼對則列印並修改狀態.超過3次退出for進入while.
Ⅲ Python讀取用戶名密碼
user = ['xrz','wyh']
password = ['123456','654321']
size = len(user)
n = 0
while True :
setting = input("請問您需要登陸,注冊,退出?1.登陸,2.注冊,3.退出\n")
if setting == '1':
User = input("請輸入您的用戶名:\n")
while n <= size:
if User == user[n]:
Password = input("請輸入您的用戶密碼:\n")
if Password == password[n]:
print("歡迎",user[n])
break
else:
print("密碼錯誤")
break
n = n + 1
if n == size:
print("用戶名不存在!")
break
elif setting == '2':
user.append(input("請輸入你要注冊的用戶名:\n"))
password.append(input("請輸入你的密碼:\n"))
print("注冊成功!")
elif setting == '3':
break
else:
print("請輸入正確的需求!")
Ⅳ Python設計一個用戶名和密碼
name=input()
if name=='這個地方是你判斷用的用戶名':
縮進pass=input()
縮進if pass=='這里是你判斷的密碼':
縮進縮進print('用戶名密碼都對')
縮進else:
縮進縮進print('密碼不對')
else:
縮進print('用戶名不對')
Ⅳ 使用python做登陸程序,在資料庫中查找用戶名和密碼是否正確,用SQLite
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 cur.fetchall():
num=num+1
print data
if(num != 0):
print '登陸成功'
else:
print '用戶名或密碼未找到'
cur.close()
conn.commit()
conn.close()
如果還有其他問題可以再問
Ⅵ python作業:1.設計賬號登錄程序,要求如下:(1)動態獲取用戶名和密碼,格式為"用戶名:密碼"
這個需求沒說清楚用什麼平台,比如是桌面版,還是web版。對所用技術或者庫有沒有什麼限制。
Ⅶ Python提供四次輸入用戶名和密碼的機會
foriinrange(1,5):user_name=input('請輸入用戶名:')user_pwd=input('請輸入密碼:')ifuser_name=='admin'anser_pwd==':print('登錄成功')break,else:print('用戶名密碼錯誤,請重新輸入')ifi<4:print(f'您還有{4-i}次機會,請重新輸入')else:print('對不起,四次均輸入錯誤,請聯系後台管理員')。
Python的底層是用C語言寫的,很多標准庫和第三方庫也都是用C寫的,運行速度非常快。
由於Python語言的簡潔性、易讀性以及可擴展性,在國外用Python做科學計算的研究機構日益增多,一些知名大學已經採用Python來教授程序設計課程。
Ⅷ 使用python做登陸程序,在資料庫中查找用戶名和密碼是否正確
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 cur.fetchall():
num=num+1
print data
if(num != 0):
print '登陸成功'
else:
print '用戶名或密碼未找到'
cur.close()
conn.commit()
conn.close()
如果還有其他問題可以再問