Fiyawerx wrote:
> Thanks Kent, thats just what I needed, but got stuck in a single mode of
> thought trying to do it inline, didn't even think of adding a separate
> function since the program seemed 'too simple'.
You can always use a lambda if you like that style:
newest = max(first_files, key=
Fiyawerx wrote:
> first_files = [ file for file in data['xls_files'] if u'First Worksheet'
> in xlrd.open_workbook(file).sheet_names() ]
> data['first_file'] = ??
> This is where I get stuck, I'm trying to figure out how, from the files
> that match, I can select the file with the most current t
In psudocode:
#map the files to their time.
filesByTimes = {}
for each in filesInDirectory:
filesByTimes[os.stat(each).st_mtime]=each
#find the largest time
times = filesByTimes.keys()
sort(times)
#retrieve the file that goes with it
latestFile = filesByTimes[times[-1]]
--Michael
On
I'm working on a small script that so far, using the xlrd module, (
http://www.lexicon.net/sjmachin/xlrd.html) will parse all the files in a
given directory for a xls file with a specific worksheet. This way, if the
file names change, or people don't save the spreadsheet with the right name,
my scr