<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body ><div><pre><code>> import webbrowser
> webbrowser.open('f:\\test.html')
 
> why the file f:\\test.html is opened by notepad </code></pre><pre><code>> ,not by my firefox or chrome?
</code></pre></div><div><code>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</code></div><div><code><br></code></div><div><code><br></code></div><div><code>file:///f:/test.html</code></div><div><code><br></code></div><div><code>I also don't run Windows any more so I might have the drive letter part wrong.</code></div><div><br></div><div>--</div>DaveA<br><br>-------- Original message --------<br>From: luofeiyu <elearn2014@gmail.com> <br>Date:09/24/2014  5:32 AM  (GMT-05:00) <br>To: python-list@python.org <br>Subject: why can't open the file with browser? <br><br>
    <pre><code>
import webbrowser
webbrowser.open('f:\\test.html')

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


</code></pre>
  

</body></html>