[Tutor] open multiple files
Tiger12506
keridee at jayco.net
Thu Aug 16 02:08:20 CEST 2007
> Hi everyone -
> I'm beginning to learn how to program in python. I need to process
> several text files simultaneously. The program needs to open several files
> (like a corpus) and output the total number of words. I can do that with
> just one file but not the whole directory. I tried glob but it didn't
> work. Your ideas are greatly appreciated. Thanks,
> Paulo
What do you have so far? I don't just want to give you an answer. You say
that glob didn't work... Probably because you are not realizing that glob
returns a list of filenames, and you can't open a whole list at a time.
You'll have to use a loop or something similar.
JS
More information about the Tutor
mailing list