擅长:python、mysql、java
<p>看来我们确实有一些打字错误,我会尽力把它弄清楚。在</p>
<pre><code>oldfiles = 0
# if newfiles is an integer, I'm not sure that it will be
# as helpful to you, I think you'd really rather have a list
newfiles = list()
for file in files:
filetimesecs = os.path.getmtime('C:/tmp/' + file)
filetime = localtime(filetimesecs)
if filetime < d:
oldfiles += 1
if filetime > d:
newfiles.append(open('C:/tmp/' + file, 'r'))
for k in newfiles:
# read the entire file and write it to standard error
sys.stderr.write(k.read())
# I believe you want the while out here, after everything is complete
# it would seem that you would want the newfiles loop within the first
# for loop
while True:
time.sleep(2)
print "new: %s" % newfiles
</code></pre>
<p>希望这有点价值。在</p>