[python] -- interesting use of the webbrowser module

D

David Stockwell

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
webbrowser.

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).

code:
------------------ START CODE -----

import webbrowser as wb

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

print "Opening instance X"
x.open('cellphone.duneram.com')

print "Opening instance Z"
z.open('/tmp/xyzabc')
----------------- FIN DE CODE -------

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

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top