This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to read contents of files with same name but in different directory

Hi I have a python question: I tried to write a script that would print out the contents of files with same name but located in many different directories . But somehow it doesnt seem to work. Can you please help??

lvspath = "/org/seg/projects/n5t/scv/users/hha/safe1/PDV/dsg_scla_en_1r1w*/lvs/lvs.sum" # Can I use wild card here?
    with open(lvspath) as f:
       head = f.readlines()[1:4]  #just want to read 5 lines per file
       for line in head:
           print line,
python

Hello howardha98!

We believe that this post does not fit the main topic of this site.

not related to bioinformatics

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.