mardi 30 mai 2017

How to open Multiple webpage one after another in python?

Let us consider the following example:

import webbrowser
Cn=('Acharya Girish Chandra Bose College','AJC Bose College','Ananda Mohan College','Asutosh College','Bangabasi College','Barrackpore Rastraguru Surendranath College','Basanti Devi College')

Cnw={'Acharya Girish Chandra Bose College':'http://ift.tt/2rBq0rS','AJC Bose College':'http://ift.tt/2saWW7p','Ananda Mohan College':'http://ift.tt/2rB3NKp','Asutosh College':'http://ift.tt/2sat1fA','Bangabasi College':'http://ift.tt/2rBbpwv','Barrackpore Rastraguru Surendranath College':'http://www.brsnc.org/','Basanti Devi College':'http://ift.tt/2saAhYU'}

yy=['Y','Yes','YES','y']
nn=['N','NO','no','No','n']
i=0
while i<=range(len(Cn)):
    print 'College Name : ',Cn[i]
    a=raw_input('Do u want to visit the website ? (Y/N) :')
    if a in yy:
        webbrowser.open(Cnw[Cn[i]])
    elif a in nn:
        break
    i=i+1

This program works fine, but I want to open next webpage after opening a webpage. This program open only one page and shows the message :
Image link here.

After opening one webpage from list it will increase i by i=i+1 and again ask to me to open the next website. Please suggest to do this




Aucun commentaire:

Enregistrer un commentaire