title: How to create a new text file using Python
body: <p>I'm practicing the management of .txt files in python. I've been reading about it and found that if I try to open a file that doesn't exists yet it will create it on the same directory from where the program is being executed. The problem comes that when I try to open it, I get this error:</p>
  
  <blockquote>
    <p>IOError: [Errno 2] No such file or directory:
    'C:\Users\myusername\PycharmProjects\Tests\copy.txt'. </p>
  </blockquote>
  
  <p>I even tried specifying a path as you can see in the error.</p>
  
  <pre><code>import os
  THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
  my_file = os.path.join(THIS_FOLDER, 'copy.txt')
  </code></pre>