why can't open the file with browser?

DaveA davea at davea.name
Wed Sep 24 14:12:15 CEST 2014


> import webbrowser
> webbrowser.open('f:\\test.html')
 
> why the file f:\\test.html is opened by notepad 
> ,not by my firefox or chrome?
The default protocol in a browser is http. If you're not running a server on your local machine,  you need to specify a different protocol.  Try


file:///f:/test.html

I also don't run Windows any more so I might have the drive letter part wrong.

--
DaveA

-------- Original message --------
From: luofeiyu <elearn2014 at gmail.com> 
Date:09/24/2014  5:32 AM  (GMT-05:00) 
To: python-list at python.org 
Subject: why can't open the file with browser? 


import webbrowser
webbrowser.open('f:\\test.html')

why the file f:\\test.html is opened by notepad ,not by my firefox or chrome?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140924/cc4dc522/attachment.html>


More information about the Python-list mailing list