if argument to python program is directory, how do i read each file?
<p>I have a program that should be run from the command prompt and as its arguement a txt file and then it parses the lines and outputs into a file of the same directory as the program.</p>

<p>But if i have a directory of multiple files I need to parse it won't work. It looks for the filename in the current directory of the program still and not in the directory and this is what i'm having trouble with, making the program read files in the directory.</p>

<pre><code>import os, sys

input_filenames = os.listdir(sys.argv[1])

for file in input_filenames:
    parser(file)
</code></pre>

<p>I'm a bit stumped on this. Any help will be much appreciated!</p>
