我有一个脚本,我只需要以2015-07-28
最后一次 git 提交的格式检索日期。
但是git log -1 --pretty=format:"%ci"
如果我想在终端中使用,Tue Jul 28 16:23:24 2015 +0530
那么如果我想
将此作为字符串传递给subprocess.Popen
喜欢
subprocess.Popen('git log -1 --pretty=format:"%cd"' shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE))
但这会给我带来错误TypeError: %c requires int or char
,我猜我们正在将 char 传递给 %c 的 python 东西,而那是为了使用 git 命令获取日期。
我需要将此日期连接到我的 python 脚本中的字符串。