Hi
 
This is my program:

import urllib
ans='y'
while ans=='y':   
    name=raw_input("Enter search:")
    name=name.replace(' ','+')
    name=name.replace('&','%26')
    go_url=" http://www.google.co.in/search?hl=en&q=%s" %name+"&meta=lr\%3Dlang_en"
    print go_url
    page = urllib.urlopen(go_url).read()
    ans=raw_input("do you want to continue?: ")

It gives following error: 

Traceback (most recent call last):
  File "C:\python\urllib.py", line 1, in -toplevel-
    import urllib
  File "C:\python\urllib.py", line 9, in -toplevel-
    page = urllib.urlopen(go_url).read()
AttributeError: 'module' object has no attribute 'urlopen'
 
What does it mean? also I tried to assign go_url as
 
    go_url="http://www.google.co.in/search?hl=en&q=%s&meta=lr\%3Dlang_en" %name
 
It takes the % in "%3D" as a part of  format is there a way I can overcome this retaining the same manner of assinging?
 
Thanks
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to