On 02/09/12 06:44, Ray Jones wrote:
I was playing with os.walk today. I can use os.walk in a for loop (does that make it an iterator or just an irritable? ^_^), but if I assign os.walk to 'test' (test = os.walk(<path>)), that variable becomes a generator object that does not work in a for loop.
It does for me.... >>> home = os.walk('/home/alang/src/Python') >>> for root,dirs,files in home: ... print root ... /home/alang/src/Python /home/alang/src/Python/modcopy /home/alang/src/Python/modcopy/src >>> What happened when you tried? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor