简体   繁体   中英

How to open an html file in web browser using python after I have logged in?

I have coded a log in system and when you've logged in I want it to open a html file in chrome. I have tried:

import webbrowser
import os
print()
f = open('code.html','w')
filename = 'file:///'+os.getcdw()+'/' + 'code.html'
webbrowser.open_new_tab('code.html')

but it has not worked. Do you have an idea why?

the code import web-browser import OS print() f = open('code.html','w') filename = 'file:///'+os.getcdw()+'/' + 'code.html' webbrowser.open_new_tab('code.html') wouldent work. You are trying to open it not just print it, try calling it like you would a javascript file that might work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM