, 31 Jul 2008 06:39:32 +0100
Subject: Re: [Tutor] Memory error - how to manage large data sets?
>
> "Kepala Pening" <[EMAIL PROTECTED]> wrote
>
> > def sumEvenFibonacci( limit ):
> > a, b = 1, 1 # don't waste with a = 0
> > sum = 0
> > w
def sumEvenFibonacci( limit ):
a, b = 1, 1 # don't waste with a = 0
sum = 0
while b < limit:
if b%2 == 0: sum += b
a, b = b, a + b
return sum
print sumEvenFibonacci( 200 )
- Original Message -
From: Chris Fuller <[EMAI
count = lambda x: [{y: x.count(y)} for y in set(x)]
y = {}
for key, val in myDict.items():
y[key] = count(val)
print y
{'1': [{'220': 3}], '3': [{'238': 1}, {'220': 1}], '2': [{'238': 4}, {'220':
1}], '5': [{'238': 1}, {'220': 2}], '4': [{'220': 2}], '7': [{'220': 1}],
'6': [{'238': 2}]}
import re
items = []
for line in open('data.txt'):
items.append(re.sub('\n', '', line).split(' '))
- Original Message -
From: "Gloom Demon" <[EMAIL PROTECTED]>
To: tutor@python.org
Date: Wed, 9 Apr 2008 15:29:35 +0300
Subject: Re: [Tutor] Tutor Digest, Vol 50, Issue 9
Hello :-)
C
--- Original Message -
From: bhaaluu <[EMAIL PROTECTED]>
To: "Kepala Pening" <[EMAIL PROTECTED]>
Cc: tutor@python.org
Date: Sat, 22 Mar 2008 09:02:40 -0400
Subject: Re: [Tutor] Even More Converter!
> import re
> num = 12345678
> print ','.join(re.findall
import re
num = 123456789
print ','.join(re.findall("\d{3}", str(num)))
output:
123,456,789
- Original Message -
From: [EMAIL PROTECTED]
To: tutor@python.org
Date: Fri, 21 Mar 2008 21:49:18 -0700
Subject: [Tutor] Even More Converter!
It works perfectly, so I am sure my question will