How to Create a file at a specific path in python?
<p>I am writing below code which is not working:</p>

<pre><code>cwd = os.getcwd()
print (cwd)
log = path.join(cwd,'log.out')
os.chdir(cwd) and  Path(log.out).touch() and os.chmod(log.out, 777)
</code></pre>

<p>how can I create a log.out into cwd ?</p>

<p>you can call the usual linux <code>touch</code> command via <code>subprocess</code></p>

<pre><code>import subprocess
subprocess.call(["touch", cwd+"/log.out"])
</code></pre>

python