Re: 2 python questions!

2007-09-06 Thread Laszlo Nagy
[EMAIL PROTECTED] wrote:
 Hi python community!
 First question has to do with threading support. There is the 
 following simple case:
 I have a dictionnary that gets it's values -which are url's-from a 
 function. Sort of

 dictionnary['1'] = http://www.google.com;
 dictionnary['2'] = http://www.python.com;
 

 I need to fill in the dictionnary with some url's. If I do it on 
 the simplest way, it would be like:

 for i in range(20):
dictionnary[%s % i] = get_urls(args)

 and wait a long long time till it finishes. Can I do it easily with 
 threads, without having to add too much code? Ideal case would be 
 if all threads start simultaneously :)
   
Look at thread.start_new_thread here: 
http://docs.python.org/lib/module-thread.html
You can call a function in a separate thread, and you do not need to 
write a new class.

(I do not like start_new_thread and I would define classes for this, but 
you are free to use this feature.)
 Now the second question has to do with images retrieval and 
 manipulation. Which libraries do you propose to work with to 
 retrieve and resize images from the web? 
   
I would use PIL because it is popular, easy to use, available on most 
platforms and has few dependencies.

Check out http://www.pythonware.com/products/pil/


Best,

   Laszlo

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


2 python questions!

2007-09-05 Thread resist_think


Hi python community!
First question has to do with threading support. There is the 
following simple case:
I have a dictionnary that gets it's values -which are url's-from a 
function. Sort of

dictionnary['1'] = http://www.google.com;
dictionnary['2'] = http://www.python.com;


I need to fill in the dictionnary with some url's. If I do it on 
the simplest way, it would be like:

for i in range(20):
   dictionnary[%s % i] = get_urls(args)

and wait a long long time till it finishes. Can I do it easily with 
threads, without having to add too much code? Ideal case would be 
if all threads start simultaneously :)


Now the second question has to do with images retrieval and 
manipulation. Which libraries do you propose to work with to 
retrieve and resize images from the web? 


Thanks in advance for any help!


--
Handyman Franchises. Click Here.
http://tagline.hushmail.com/fc/Ioyw6h4fMyhGJzTqAUMT4o9Inh2I0NfM85HrFhPDGb7fSaLiZQZqWk/

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


Re: 2 python questions!

2007-09-05 Thread Christof Winter
[EMAIL PROTECTED] wrote:
[...]

 Now the second question has to do with images retrieval and 
 manipulation. Which libraries do you propose to work with to 
 retrieve and resize images from the web? 

urllib.urlretrieve() and
Python Imaging Library (PIL)
-- 
http://mail.python.org/mailman/listinfo/python-list