[Tutor] Generator expressions...

Corey Richardson kb1pkl at aim.com
Sun Feb 27 22:41:27 CET 2011


On 02/27/2011 04:34 PM, Modulok wrote:
> 
> import hashlib
> 
> fd = open('/dev/urandom', 'rb')
> gen = (hashlib.sha256(i).hexdigest() for i in fd.read(4096))
> 

I think the problem is that you're only reading 4096 bits (bytes? No
idea), and iterating through that. I could be wrong.

-- 
Corey Richardson


More information about the Tutor mailing list