condensed syntax?

Matthieu Bec mbec at gemini.edu
Tue Jul 30 05:50:52 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 mbec_AT_gemini_DOT_edu as I am not actively
monitoring this newsgroup



More information about the Python-list mailing list