def stat(pid):
 with open(('/proc/%d/stat' % pid)) as fd:
  s = fd.read()
 i = s.find('(')
 j = s.rfind(')')
 name = s[(i + 1):j]
 return ((s[:i].split() + [name]) + s[(j + 1):].split())

def stat ( pid ) : with open ( ( '/proc/%d/stat' % pid ) ) as fd : s = fd . read ( ) i = s . find ( '(' ) j = s . rfind ( ')' ) name = s [ ( i + 1 ) : j ] return ( ( s [ : i ] . split ( ) + [ name ] ) + s [ ( j + 1 ) : ] . split ( ) )
get status of a finalized file given its full path filename .