condensed syntax?

Matthieu Bec mbec at gemini.edu
Tue Jul 30 05:43:33 EDT 2002


is there any way to condense the following:

      # scan subdir(s) within mydir
      for d in os.listdir(mydir):
         dd=os.path.join(mydir,d)
         if os.path.isdir(dd):
            self.subdir.append(dd)


what follows doesn't work, but I'm thinking of a something like:

	self.subdir=[(os.path.isdir(dd=os.path.join(mydir,d))?dd:pass) for d in
os.listdir(mydir) ]


Thanks,

Matthieu

PS: please fwd. answer to this email as I am not on the newsgroup


-- 
Matthieu Bec              Gemini Observatory
Tel: +1 808 9742557       670 N. A'ohoku Place
Fax: +1 808 9359235       Hilo, Hawaii 96720, USA




More information about the Python-list mailing list