title: How to set file permissions in Python3?
body: <p>Python's own docs are quite terse about how to use functions like <code>os.fchmod</code>, <code>os.chmod</code>. I am confused by numbers like <code>777</code> and expressions like <code>stat.S_IWRITE | stat.S_IEXEC</code>.</p>
  
  <p>And what is <code>mode=0o777</code> I see in some functions in the <code>os</code> module?</p>
  
  <p>Can you please explain what this is?</p>