Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8218221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:43:01+00:00 2026-06-07T12:43:01+00:00

So I am using writing this method, which work fine in term of looking

  • 0

So I am using writing this method, which work fine in term of looking up number but it only return last value. is there a way to make it so it return all the values after each run.
here is my code:

def searchPFAM():

    fileAddress = '/Volumes/interpro/data/Q14591.txt'
    start = None
    end = None
    with open(fileAddress,'rb') as f:
        root = etree.parse(f)
        for lcn in root.xpath("/protein/match[@dbname='PFAM']/lcn"):#find dbname =PFAM
            start = int(lcn.get("start"))#if it is PFAM then look for start value
            end = int(lcn.get("end"))#if it is PFAM then also look for end value
            print start, end
        return start, end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:43:03+00:00Added an answer on June 7, 2026 at 12:43 pm

    Do you mean something similar to this?

    def do_something(fname):
        with open(fname,'rb') as f:
            root = etree.parse(f)
            for lcn in root.xpath("/protein/match[@dbname='PFAM']/lcn"):#find dbname =PFAM
                # Make slightly more robust
                try:
                    start = int(lcn.get("start"))#if it is PFAM then look for start value
                    end = int(lcn.get("end"))#if it is PFAM then also look for end value
                    yield start, end
                except (TypeError , ValueError) as e:
                    pass # start/end aren't usable as numbers decide what to do here...
    
    for start, end in do_something():
        do_something_else(start, end)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using StreamWriter to write log file. And this is the writing log method,
I was writing a method which takes DateTime value as one of it's parameters.
I am writing code to work with Amazon query based APIs, which return XML
So I've been writing this tool and I am using these Sockets (not these
Need help writing a script downloads data from google insight using c# this is
I'm writing an application using DDD techniques. This is my first attempt at a
This popped-up while writing a script for vim. Using the well-documented ':normal' command: :normal
I am writing a GUI application using Django 1.1.1. This is the views.py: from
I am writing application in Linux using C, pthreads and sockets. This will be
Writing a python program, and I came up with this error while using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.