[Biopython] A potential printing error in the Biopython Tutorial and Cookbook?

Michiel de Hoon mjldehoon at yahoo.com
Sat Dec 12 01:52:08 UTC 2009


Dear Angel,

This was indeed a typing error in the tutorial.
It is fixed now as Peter suggested.
Thanks for noticing!

--Michiel.

--- On Fri, 12/11/09, Peter <biopython at maubp.freeserve.co.uk> wrote:

> From: Peter <biopython at maubp.freeserve.co.uk>
> Subject: Re: [Biopython] A potential printing error in the Biopython Tutorial and Cookbook?
> To: "ANGEL VILLAHOZ-BALETA" <villahozbale at wisc.edu>
> Cc: biopython at lists.open-bio.org
> Date: Friday, December 11, 2009, 2:45 PM
> On Fri, Dec 11, 2009 at 6:32 PM,
> ANGEL VILLAHOZ-BALETA
> <villahozbale at wisc.edu>
> wrote:
> > Hi to all,
> >
> > I believe that there is a printing error in the
> Biopython Tutorial and Cookbook...
> >
> > Go there:
> >
> > http://www.biopython.org/DIST/docs/tutorial/Tutorial.html#htoc102
> >
> > Then check the following source code:
> >
> >>>> for record in records:
> > ...     print "title:", record["TI"]
> > ...     if "AU" in records:
> > ...         print "authors:", record["AU"]
> > ...     print "source:", record["CO"]
> > ...     print
> >
> > I believe that the if sentence would have the record
> > instead of the records because it would never print
> > such an information about the authors since the data
> > structure of records does not have this key but
> always
> > integers as its indices.
> 
> What version of Biopython do you have?
> Could you show us the actual error message?
> 
> I've just been playing with the example, and for some
> records certain fields are missing (you get a KeyError),
> so this works better:
> 
> for record in records:
>     print "title:", record.get("TI","?")
>     print "author:", record.get("AU","?")
>     print "source:", record.get("CO","?")
>     print
> 
> Does that help?
> 
> Peter
> 
> _______________________________________________
> Biopython mailing list  -  Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
> 


      




More information about the Biopython mailing list