Mensanator wrote:
from __future__ import division
at the top of the file. I put this at the top of all my Python files,
whether I expect to be dividing or not. It just saves grief.
If you want division to be floating point.
If, like me, you rarely do floating point
division and want the "/" t
On Dec 19, 9:23�am, Joe Strout wrote:
> Peter Otten wrote:
> > If you are using Python 2.x:
> > ...
> > So you better throw in a float(...):
>
> Or, add
>
> � �from __future__ import division
>
> at the top of the file. �I put this at the top of all my Python files,
> whether I expect to be dividi
Peter Otten wrote:
If you are using Python 2.x:
...
So you better throw in a float(...):
Or, add
from __future__ import division
at the top of the file. I put this at the top of all my Python files,
whether I expect to be dividing or not. It just saves grief.
Cheers,
- Joe
--
http://
Bruno Desthuilliers wrote:
> Steven Woody a écrit :
>> In additional to max/min, is there something like average()?
>
> Not AFAIK, but it's really trivial
>
> def average(lst):
> """ assume lst is a list of numerics """
> return sum(lst) / len(lst)
If you are using Python 2.x:
>>> def
John Machin a écrit :
On Dec 20, 12:33 am, Bruno Desthuilliers wrote:
Steven Woody a écrit :> Hi,
I am a newbie and is reading the python book. Could anyone tell me,
how to parsing the following string
"123 100 12 37 ..."
> into a list of integers on which I can then apply max()/min()?
On Fri, Dec 19, 2008 at 9:33 PM, Bruno Desthuilliers
wrote:
> Steven Woody a écrit :
>>
>> Hi,
>>
>> I am a newbie and is reading the python book. Could anyone tell me,
>> how to parsing the following string
>> "123 100 12 37 ..."
>
>> into a list of integers on which I can then apply max()/min
On Dec 20, 12:33 am, Bruno Desthuilliers wrote:
> Steven Woody a écrit :> Hi,
>
> > I am a newbie and is reading the python book. Could anyone tell me,
> > how to parsing the following string
> > "123 100 12 37 ..."
>
> > into a list of integers on which I can then apply max()/min()?
>
> sour
On Fri, 19 Dec 2008 21:20:48 +0800, Steven Woody wrote:
> Hi,
>
> I am a newbie and is reading the python book. Could anyone tell me, how
> to parsing the following string
>"123 100 12 37 ..."
> into a list of integers on which I can then apply max()/min()?
In [376]: '123 100 12 37'.split()
Steven Woody a écrit :
Hi,
I am a newbie and is reading the python book. Could anyone tell me,
how to parsing the following string
"123 100 12 37 ..."
> into a list of integers on which I can then apply max()/min()?
source = "123 100 12 37"
list_of_ints = [int(part) for part in source.stri
Hi,
I am a newbie and is reading the python book. Could anyone tell me,
how to parsing the following string
"123 100 12 37 ..."
into a list of integers on which I can then apply max()/min()?
In additional to max/min, is there something like average()?
Thanks in advance.
-
narke
--
http://ma
10 matches
Mail list logo