[python-win32] RE Explained With screenshot

Tim Roberts timr at probo.com
Tue Nov 21 00:57:16 CET 2006


James Matthews wrote:
>> Code:
>>   
>>     
>>>>> from re import findall
>>>>> from urllib import basejoin,urlopen
>>>>> site = urlopen("http://www.goldwatches.com/watches.asp?Brand=11").read()
>>>>> findall(r'\?Brand=\d+\&pg=\d+',site)
>>>>>         
>>>>>           
>> Now as you see in the screen shot the interactive interpreter returns
>> me a list of values however when i run it in regular python i get an
>> empty list why??
>>     

It works for me inside Pythonwin, in a command line in a .py file, and
in the command line interactive interpreter.

You should copy "site" to a file so you can look at it and make sure it
is exactly as you expect.  The "Brand=11" file should be 41,251 bytes.

Also, it is possible you are confusing the debugger by having your
parameter and your result list both called "site".  Why don't you change
the parameter to "url" so there is no confusion.

Can you post the entire program?>

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list