common.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:Qyoutube-dl 作者: lzambella 项目源码 文件源码
def try_utime(self, filename, last_modified_hdr):
        """Try to set the last-modified time of the given file."""
        if last_modified_hdr is None:
            return
        if not os.path.isfile(encodeFilename(filename)):
            return
        timestr = last_modified_hdr
        if timestr is None:
            return
        filetime = timeconvert(timestr)
        if filetime is None:
            return filetime
        # Ignore obviously invalid dates
        if filetime == 0:
            return
        try:
            os.utime(filename, (time.time(), filetime))
        except Exception:
            pass
        return filetime
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号