http://stackoverflow.com/questions/237079/how-to-get-file-creation-modification-date-times-in-python
import os, time
(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat(file)
print "last modified: %s" % time.ctime(mtime)
pretty
Sunday, November 25, 2012
File modification time python
Wednesday, November 14, 2012
Update all python pip packages
i use it with ipython
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
sudo ipython
""" Cut the code above and type
%paste
Monday, November 5, 2012
Kill process with python on linux
look here for a windows solution or google it
import os
import signal
def kill_process(processname):
for line in os.popen("ps xa"):
fields = line.split()
pid = fields[0]
process = fields[4]
print process
if process == processname:
os.kill(int(pid), signal.SIGKILL)
break
else:
pass
Subscribe to:
Posts (Atom)