rbt wrote:
> Heiko Wundram wrote:
>>>>> import os
>>>>> path = "/home/heiko"
>>>>> file_count = sum((len(f) for _, _, f in os.walk(path)))
>>>>> file_count
> 
> Thanks! that works great... is there any significance to the underscores 
> that you used? I've always used root, dirs, files when using os.walk() 
> do the underscores make it faster... or more efficient?

No, they don't make any semantic difference; they work just like any 
other identifier.  It's just that, by convention, single underscores 
indicate that we don't care what values these names are bound to.  So in 
the example above, Heiko indicates that we don't care about what you 
would normally call 'root' and 'dirs'.

HTH,

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to