Processing file with lists.

2010-11-25 Thread Geobird
I have  a text  file , having  fields  delimited by  ;  in the first
line and  all the way  down is the data taken for those fields . Say
FAMILY NAME;SPECIES/SUBSPECIES;GENUS NAME;SUBGENUS NAME;SPECIES
NAME;SUBSPECIES NAME;AUTHORSHIP
Acrididae;Acanthacris ruficornis (Fabricius,
1787);Acanthacris;;ruficornis;;(Fabricius, 1787)
Acrididae;Acrida bicolor (Thunberg, 1815);Acrida;;bicolor;;(Thunberg,
1815)
Acrididae;Acrida oxycephala (Pallas, 1771);Acrida;;oxycephala;;
(Pallas, 1771)
Acrididae;Acrida turrita (Linnaeus, 1758);Acrida;;turrita;;(Linnaeus,
1758)

I want  to know how  could  I process this file using ' lists '  ,
that  could  answer   questions like . How many ? ,  Who did .. ?
etc.

I am a newbie , and would  appreciate your help
-- 
http://mail.python.org/mailman/listinfo/python-list


How on Factorial

2010-10-26 Thread Geobird

  I  am a beginner in Python and would ask for a help.


I  was searching for  smaller  version  of  code  to calculate
factorial . Found  this one
def fact(x):
return x > 1 and x * fact(x - 1) or 1

 But I don't  really get how (  x > 1 and x * fact(x - 1))
works .
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How on Factorial

2010-10-27 Thread Geobird
@ Ulrich : Tx
@ Rebert : Appreciate your interpretation.
   It  made  me think about ternary operation . Say
 >>> (a > b) and x or y

   Are all ternary operations prone to ...( in your words )
   > It exploits short-circuit evaluation
   >(http://en.wikipedia.org/wiki/Short-circuit_evaluation ). This is
   >stunt coding / code golf; no one should actually write factorial
like
   >that.

-- 
http://mail.python.org/mailman/listinfo/python-list