import os.path

tokens=['E']
result=[]

for fileName in os.listdir("."):
    if os.path.isfile(fileName) and os.path.splitext(fileName)=="xpm":
        filedata = open(fileName)
        text=filedata.readlines()
        for line in text:


How can I read from line 24 and do further looking for "E".

Thanks,


On Thu, Sep 29, 2011 at 10:43 PM, Dave Angel <d...@davea.name> wrote:

> On 09/29/2011 10:22 AM, lina wrote:
>
>> Hi,
>>
>> 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.
>>
>> THanks,
>>
>>  Look in the os module for things like this.  In particular (untested):
>
> import os.path
>
> for fileName in os.listdir(".")
>    if os.path.isfile(fileName) and os.path.splitext(fileName) == "doc":
>        filedata = open(fileName)
>        xxxdosomething with filedata
>
>
>
> --
>
> DaveA
>
>


-- 
Best Regards,

lina
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to