samedi 17 novembre 2018

Python 3: AttributeError: 'int' object has no attribute 'choice'

Trying to run this python 3 program but it seems it can't run past the first loop.

import webbrowser
import time
import random

while True:
    sites = ['www.google.com', 'www.mastercode.com', 'www.youtube.com']
    site = random.choice(sites)
    visit = ("http://{}".format(site))
    webbrowser.open(vist)
    time.sleep(2)

After the 1st loop it gives this error:

AttributeError: 'int' object has no attribute 'choice'

I am unable to fix it.I am still new to python 3.




Aucun commentaire:

Enregistrer un commentaire