避免在Zipfile.write中更改日期

问题描述

看看Zipfile模块,我试图弄清楚为什么当我重新创建具有相同内容文件时zipfile的内容会发生变化

这是我正在处理的示例代码

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&display=swap');
* {
  font-family: 'Montserrat',sans-serif;
}

html,body {
  height: 100%;
  width: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.one {
  width: 80%;
  height: 80%;
  display: flex;
  flex-direction: row;
  background: #232323;
  opacity: 0.9;
}

.two {
  width: 50%;
}

.four {
  float: left;
  width: 100px;
  height: 100px;
  margin-left: 10px;
  margin-top: 10px;
  border: 2px solid #fff;
  display: flex;
  flex-direction: column;
}

.five {
  height: 100%;
  background-image: url(https://logodownload.org/wp-content/uploads/2015/04/whatsapp-logo-1-1.png);
  background-repeat: no-repeat;
  background-position: 0% 0%;
  background-size: 100%;
}

.five-a {
  float: left;
  color: white;
  margin-left: 5px;
}

.five-b {
  float: right;
  color: white;
  margin-right: 5px;
}


/*fit image to the square and center it*/

这首先创建一个文件,然后将其压缩并打印出压缩数据的哈希值。

多次运行会导致内容/哈希不同,我认为这是由修改日期引起的(我的假设是based on this,它也显示<div class="one"> <div class="two"> <div id="tree"> <div id="0" class="four"> <div class="five"> <span class="five-a">1</span> <span class="five-b">10</span> <img src=""> </div> </div> </div> </div> </div>日期)

我只想压缩实际内容,而不压缩其他内容(例如,如果我为给定文件重新创建相同内容,则哈希应保持不变)

有人建议如何实现此目标/在归档文件时忽略其他信息吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)