[Tutor] a quick Q: how to use for loop to read a series of files with .doc end

lina lina.lastname at gmail.com
Thu Sep 29 16:39:36 CEST 2011


On Thu, Sep 29, 2011 at 10:25 PM, Tim Golden <mail at timgolden.me.uk> wrote:

> On 29/09/2011 15:22, lina wrote:
>
>> I want to read a bunch of *.doc file in present working directory,
>>
>> how can I use for to read one by one and do further work,
>>
>> sorry,
>>
>> what's the best reference webpage I can use?
>>
>> I googled, lots of distracting info, and I barely can understand how
>> they think.
>>
>
> Try these:
>
> http://docs.python.org/**library/glob.html<http://docs.python.org/library/glob.html>
>
> http://www.doughellmann.com/**PyMOTW/glob/index.html<http://www.doughellmann.com/PyMOTW/glob/index.html>
>

Thanks,


import glob

for FILE in glob.glob('*.xpm'):
    print FILE

How do I not print FILE,
I want to put those files in a for loop

and then further to read one by one,

Thanks,


>
> TJG
>



-- 
Best Regards,

lina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110929/fe34f997/attachment.html>


More information about the Tutor mailing list