title: Python - Set file EOF
body: <p>Say, for some reason, I have a 1 TB file. In Python, if I wanted to add 10 bytes, I could just seek to the end, and write a 10 byte string. However, say I'd like to cut 10 bytes off the end of it. Obviously, it would take a ridiculous amount of time (and there may not even be HDD space) to copy this file without the excess 10 bytes, then delete the old one.</p>
  
  <p>In c++ for Windows, there's a function, <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa365531(v=vs.85).aspx" rel="nofollow noreferrer"><code>SetEndOfFile</code></a>, that lets me change file size to something smaller without file rewriting.</p>
  
  <p>Is there a similar function in python that will do this? I've researched and cannot find anything...</p>