How to create a file in a folder
<p>How can i create a <code>.pck</code> file in a folder in Python?
The name of the folder is example
I tried:</p>

<pre><code>file = open("\example\file.pck","wb")
</code></pre>

<p>But it says: </p>

<blockquote>
  <p>OSError: [Errno 22] Invalid argument: '\example\x0cile.pck'</p>
</blockquote>

<p>EDIT:
Solved! The right command is:<code>
file = open("example/file.pck", "wb")</code></p>

<p>You need to use forward slashes and also it seems that the <code>example</code> folder you trying to access doesn't exist. That's probably because you wanted to enter relative address but you entered an absolute one. So it should be:</p>

<p><code>open("example/file.pck", "wb")</code></p>

python