[python] -- interesting use of the webbrowser module

David Stockwell winexpert at hotmail.com
Thu Jun 10 20:37:25 CEST 2004

In the ongoing endeavor to learn python I started playing with the 
webbrowser module.

In this case I found an unorthodox way to launch an editor using the 

Instance x just uses lynx to open a website.

instanze z however, opens an editor on a file.  I'm sure there are other 
ways to do it, I just saw it as a slightly different way to do this.

I guess what it really means is the 'open' simply launches the requested 
application and then that application does whatever it does.

One thing I did notice is that the 2nd launch doesn't occur until the first 
has completed. which makes each of these operations synchronous in nature.  
(no kwrite until lynx has closed).

------------------ START CODE -----

import webbrowser as wb

x = wb.GenericBrowser('lynx %s')
z = wb.GenericBrowser('kwrite %s')

print "Opening instance X"

print "Opening instance Z"
-----------------  FIN DE CODE -------

Tracfone: http://cellphone.duneram.com/index.html

FREE pop-up blocking with the new MSN Toolbar – get it now! 

More information about the Python-list mailing list