python - looping throught the folder -
I have to solve a trivial task in the loop sequence of command:
1) To take input
looks like My code (which is not working!)
# List of input DCD files = ". In transistor for / inputs / "dirs = os.listdir (path) trail: trajectory = command (traj)
This correctly defines the name of the input but is written That the Avery file is empty
Alternatively, I have given the following script Repeat is used through files using the value of each file in the loop in the name of the file (which is not good in my current work because I need it to keep the name of every input file which is avoiding using numbers !)
# number of input files for i in xrange (1, n + 1) n = 3: trajectory = command ('./ input / file_% d.dcd'% ( I))
In the previous case, all the DCD files are correctly It happened (unlike the first example)! So the question is, should I correct myself in the first instance?
os.listdir () You only need the base filename directory Relates to No path is included.
Prefix your file names along the path:
Transit in Transit: Trafficator = command (os.path.join (path, traj))
Comments
Post a Comment