On Feb 10, 2014 10:33 AM, "rahmad akbar" <matbioi...@gmail.com> wrote:
>
> hey again guys, i am trying to understand these statements,
>
> if i do it like this, it will only print the 'print locus' part
>
> for element in in_file:
      # do this
     print element
>   if element.find('LOCUS'):
>     locus += element
>   elif element.find('ACCESSION'):
>     accession += element
>   elif element.find('ORGANISM'):
>     organism += element
>
> print locus
> print accession
> print organism
>
>
> once i add >= 0 to each if conditions like so, the entire loop works and
prints the 3 items
>
> for element in in_file:
>   if element.find('LOCUS') >= 0:
>     locus += element
>   elif element.find('ACCESSION') >= 0:
>     accession += element
>   elif element.find('ORGANISM') >= 0:
>     organism += element
>
> print locus
> print accession
> print organism
>
> why without '>= 0' the loop doesnt works?
> --
> many thanks
> mat
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to