ps reference. this command was pretty mysterious to me, with several types of option syntax.
Showing posts with label os. Show all posts
Showing posts with label os. Show all posts
Thursday, August 23, 2012
Tuesday, April 3, 2012
Check if files in a list exist with Python
I needed to test whether a large list of galaxies have corresponding mask files in a certain directory. The tentative mask filenames were created by a code that cross-correlated internal survey galaxy IDs with their respective NED names.
wrongFilenames = []
for i in range(0, noOfGalaxies):
maskFile = GalaxyParameters.getMaskUrl(listFile, dataDir, simpleFile, i)
print i, 'maskfile: ', maskFile
try:
f = open(maskFile)
print "maskfile exists:", maskFile
except IOError as e:
wrongFilenames.append(maskFile)
Subscribe to:
Posts (Atom)