title: Python equivalent of Perl file test readable (-r), writeable (-w) and executable (-x) operators
body: <p>I have been Googling to try and find an equivalent in Python to some of Perl's file test operators. </p>
  
  <p>Most of the file test operators are just a direct Pythonification of the underlying os' <code>stat</code> call. For example, <code>os.stat('file').st_ctime</code> just reads the inode change time as the *nix <code>stat</code> utility or <code>ls -l</code> would do.</p>
  
  <p>Some of the Perl file test operators I cannot find an equivalent in Python. For example, I have a data tree of 85,000 image files created by a variety of applications. Some of the files have the <a href="http://unixpapa.com/incnote/setuid.html" rel="noreferrer">effective UID</a> set in a way that is nettlesome and a modification fails for a permission issue. So for those files I need to run something like:</p>
  
  <pre><code>$ find . -type f -print0 | perl -0 -lnE 'say unless -w' | change euid...
  </code></pre>
  
  <p>Since I have not found the equivalent in Python, I have to shell out to Perl to find these files. I found <a href="http://blog.endpoint.com/2009/08/file-test-comparison-table-for-shell.html" rel="noreferrer">this table</a> which suggests there is no direct equivalent. True?</p>