2

I'm at Day 1 on Python and I've just made this Admin Login Page script. I would love if it redirects you to a website when you insert the correct username and password. I've already searched on stackoverflow for this but I can't get something "easy". Any suggestions?

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")
CastiiGFX
  • 33
  • 1
  • 4
  • Which website? is it your own site? are you building a website using Python? – just10minutes Jul 14 '17 at 14:19
  • 1
    If this is day 1, just carry on with little scripts doing `print`, `if` and `raw_input`. Don't worry about redirecting and websites. You're not there yet. – khelwood Jul 14 '17 at 14:19
  • I think this was a very good and clear question for someone that has written python for 1 day, I don't think it deserves downvotes. – Hannes Landeholm Jul 14 '17 at 15:20
  • I think "redirect" confuses people because they think you're writing a web application, but your code just looks like vanilla python. – Hannes Landeholm Jul 14 '17 at 15:25
  • Possible duplicate of [How can I open a website in my web browser using Python?](https://stackoverflow.com/questions/31715119/how-can-i-open-a-website-in-my-web-browser-using-python) – Thierry Lathuille Jul 16 '17 at 08:45

1 Answers1

8

To open a web page from python:

import webbrowser

webbrowser.open('http://example.com')  # Go to example.com
Hannes Landeholm
  • 1,525
  • 2
  • 17
  • 32