2017-07-14 38 views
0

我在第1天使用Python,並且剛剛創建了此管理員登錄頁面腳本。 如果在插入正確的用戶名和密碼時將網址重定向到網站,我很樂意。 我已經在stackoverflow上搜索過這個,但是我找不到「簡單」的東西。 有什麼建議嗎?重定向到Python中的網站

print ("Pannello di Log-In in caricamento") 
import time 
time.sleep (2) 
username=raw_input ("USERNAME: ") 
if username=="admin": 
    time.sleep (1) 
    print (" ") 
else: 
    time.sleep (1) 
    print (" ") 
password=raw_input ("PASSWORD: ") 
if password=="psw": 
    time.sleep (1) 
    print ("LOGGING-IN") 
else: 
    time.sleep (1) 
    print ("LOGGING-IN") 
+0

哪個網站?它是你自己的網站?你在用Python構建一個網站嗎? – just10minutes

+1

如果這是第1天,只需執行'print','if'和'raw_input'的小腳本即可。不要擔心重定向和網站。你還沒到。 – khelwood

+0

我認爲這對於已經寫了python 1天的人來說是一個非常好的和明確的問題,我認爲它不值得推薦。 –

回答

2

從蟒蛇打開一個網頁:

import webbrowser 

webbrowser.open('http://example.com') # Go to example.com