tnblog
首页
视频
资源
登录

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

4041人阅读 2020/9/16 17:01 总访问:85829 评论:1 收藏:0 手机
分类: python
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")


评价
我要变强不变秃
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
欢迎加群交流技术