荔枝大娘

Python PyQt5 跨平台 读取linux 路径的坑

电脑版发表于:2020/9/16 17:01
self.url = os.path.abspath('.').replace("\\","/") + r'/youer_file_path/filename.html'

这样写 linux 是读不到文件 按道理说 路径转成 / 是可以的 但是就是读取不到 

解决方案:

self.url = "file://" + os.path.join(os.getcwd(), "you_file_path/filename.html")


关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢