Convert a filename to a file:// URL

前端 未结 4 1618
眼角桃花
眼角桃花 2020-12-05 06:46

In WeasyPrint’s public API I accept filenames (among other types) for the HTML inputs. Any filename that works with the built-in open() should work, but I need

4条回答
  •  攒了一身酷
    2020-12-05 07:04

    Does the following work for you?

    from urlparse import urlparse, urlunparse
    
    urlunparse(urlparse('yourURL')._replace(scheme='file'))
    

提交回复
热议问题