Showing posts with label Python Script to Open Webpages in Firefox tabs (or any browser supported by the python webbrowser library). Show all posts
Showing posts with label Python Script to Open Webpages in Firefox tabs (or any browser supported by the python webbrowser library). Show all posts

Thursday, January 19, 2012

Python Script to Open Webpages in Firefox tabs (or any browser supported by the python webbrowser library)

  #python  
import webbrowser  
a = ['http://www.google.com/reader','http://www.yahoo.com/','http://www.facebook.com/']  
  for x in a:  
       webbrowser.get('firefox').open_new_tab(x)  

You just need to copy and paste that code into a text file and save it as something like "opensite.py" (better to use the .py extension)

Make it executable running the following command in terminal:
 sudo chmod a+x opensite.py  

Run it either in the command line with
 python /path/to/opensite.py  

Or create a launcher (you can do this in Ubuntu easily by right clicking on the desktop)