Schwartzian Transform in Python?
Art Haas
arthur.haas at westgeo.com
Thu Apr 27 11:48:16 EDT 2000
I'm looking for the Python way to do this ...
opendir(DIR,".") || die "Can't open '.'! $!\n"
@sorted =
map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [ $_ , -M ]} readdir(DIR)
closedir(DIR);
print "Files sorted by date ...\n";
foreach (@times) {
print "$_\n";
}
(Yes, its that other 'P' language).
I'm getting lost in the map/sort/map part for python. My python psuedo
code looks like (don't laugh too much)
import os
sorted = map(???,(map(os.stat???,listdir(".").sort())))
print "Files sorted by date ..."
for file in sorted:
print file
I've been working with that language that dare not speak its name here
for about 5 years, but my python coding has been much much less. A
search on starship provided the nice p***/python page dealing with
lists, hashes/dictionaries, and strings, but I haven't found much
dealing with what is done above. The python documentation doesn't make
clear to me how to do things like "sort a list of lists by the second
field in each sublist", which is what the Schwartzian transform is
based on.
Any help/references would be welcomed.
--
###############################
# Art Haas
# (713) 689-2417
###############################
More information about the Python-list
mailing list