First of all I am a new coder so this question is probably a basic one. I have searched and searched but could not find and answer to my specific question. I am trying to have the output from a random choice open a web page, depending on the output will depend on which web page is opened up.
import webbrowser
import random
Between_the_Buried_and_Me = ['Colors', 'Parallax 2',
'Alaska','Coma Ecliptic']
Mastodon = ['OMRTS','Blood Mountain']
if random.choice(Mastodon) == 'OMRTS':
webbrowser.open('http://ift.tt/1dYsjbp
/lyrics/mastodon/oncemoreroundthesun.html')
Every time I run this in the shell it immediately opens the link. I have tried setting 'OMRTS' to equal to the web page link however, I get an error message regarding not being able to assign to literal. I've tried setting the conditional to equal integers from the list to open the web page still, nothing works.
Aucun commentaire:
Enregistrer un commentaire