accessing files in a folder using python
Question: I have a python script that runs a program, which generates few .exe files and
puts them in a folder. I want to access these exe files to do further testing,
the problem is that this folder name is not static (it's dynamic? ), the name
depends on the OS,compiler,binary type(64/32-bit), so I can't hard code the
directory.

So What is the best to access folders like this? , I tried looking this up but
I haven't got a clue as to how to approach this.


Answer: Just pass the folder name as a parameter to your python script:

    
    
    python myscript.py FolderName
    

In `myscript.py`:

    
    
    import sys
    print sys.argv[1]
    

`sys.argv` gives you all the parameters.

