[Biopython] [Entrez] use the handle twice

c.buhtz at posteo.jp c.buhtz at posteo.jp
Sat Dec 19 09:59:09 UTC 2015


I want to use the handle returned by Entrez.efetch() twice.

First time, write the xml to a file

	f.write(handle._handle.read())

But I want to know how much records are in there.

	records = Entrez.read(handle)
	print(records['Count'])

This doesn't work here because the handle is "empty" after the first
read()-call.

Open an read the xml-file would be a resource wasting workaround and not
a solution.
-- 
GnuPGP-Key ID 0751A8EC


More information about the Biopython mailing list