On Thu, Nov 18, 2010 at 10:46 AM, Kenneth Gonsalves <law...@au-kbc.org>wrote:
> On Thu, 2010-11-18 at 10:26 +0530, Asokan Pichai wrote: > > On 18 November 2010 09:35, Nitin Kumar <nitin.n...@gmail.com> wrote: > > > hi all, > > > > > > is there any simple way where a can parse into directory and > > subdirectories > > > to get the detail of files and count. > > > > Check if os.walk() is useful. > > but that is looping - which he does not want. > Am unclear by what specifically is the issue here with looping, but list comprehensions can be quite useful (even though implicitly they use iterators as do loops). Something along the lines of print list((dirpath, len(filenames)) for dirpath, dirnames, filenames in os.walk('/home/user')) > -- > regards > Kenneth Gonsalves > > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- -------------------------------------------------------- blog: http://blog.dhananjaynene.com twitter: http://twitter.com/dnene _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers