In article <2fwdnxofjat-whnwnz2dnuvz_rgdn...@insightbb.com>,
monkeys paw  <mon...@joemoney.net> wrote:
>On 2/23/2010 3:17 PM, Tim Chase wrote:
>> 
>> Sure you don't need this to be 'wb' instead of 'w'?
>
>'wb' does the trick. Thanks all!
>
>import urllib2
>a = open('adobe.pdf', 'wb')
>i = 0
>for line in 
>urllib2.urlopen('http://www.whirlpoolwaterheaters.com/downloads/6510413.pdf'):
>     i = i + 1
>     a.write(line)

Using a for loop here is still a BAD IDEA -- line could easily end up
megabytes in size (though that is statistically unlikely).
-- 
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to