accessing sub directory in python
<p>I'm trying to access a folder that is in the current directory in which I am writing my code.  the folder I am currently in is cs113</p>

<p>I've tried to do </p>

<pre><code>file2 = open("/cs113/studentstoires/Zorine.txt", "r)"
</code></pre>

<p>Would someone please tell me whey this doesn't work I've also tried to write the directory name like this:</p>

<pre><code>open("/studentstories/Zorine.txt", "r")
</code></pre>

<p>Do I need to import sys and use sys.listdir or os.path? If so can you please give a quick little example how to do this? Thank you in advance.</p>

<p>If it's in the current directory, and <strong>it's the directory where you execute the script from</strong>, you should write the path without the <code>/</code> up front like so:</p>

<pre><code>file2 = open("studentstories/Zorine.txt", "r")
</code></pre>

python file text directory