<p>谢谢贝雷尔</p>
<p>在你的纠正下,我已经创造了最终的。。在</p>
<pre><code># -
# Convert Unix timestamp to Readable Date/time
# -
def convUnixTime(t):
return datetime.datetime.fromtimestamp(t*60*60*24)
# -
# Read shadow file and check for account expriry
# -
with open( "/etc/shadow" ) as shadow:
for aLine in shadow:
filed = aLine.split(":")
f = filed[7]
try:
f = int(f)
exprdate = convUnixTime(f)
f=1+( exprdate - datetime.datetime.today()).days
l=[f,exprdate]
except ValueError:
pass
else:
if f <= min_days:
expr_list[filed[0]]=l
if f <= 0:
total_expired_users += 1
else:
total_expring_users += 1
</code></pre>
<p>分析完整个<a href="http://www.pasteall.org/43086/python" rel="nofollow">Script</a>。。
输出:</p>
^{pr2}$