With regards to urllib AttributeError: 'module' object has no attribute 'urlopen'
Question: 
    import re
    import string
    import shutil
    import os
    import os.path
    import time
    import datetime
    import math
    import urllib
    from array import array
    import random
    
    filehandle = urllib.urlopen('http://www.google.com/') #open webpage
    s = filehandle.read() #read 
    print s #display
    
    #what i plan to do with it once i get the first part working
    #results = re.findall('[<td style="font-weight:bold;" nowrap>$][0-9][0-9][0-9][.][0-9][0-9][</td></tr></tfoot></table>]',s)
    #earnings = '$ '
    #for money in results:
    #earnings = earnings + money[1]+money[2]+money[3]+'.'+money[5]+money[6]
    #print earnings
    #raw_input()
    

this is the code that i have so far. now i have looked at all the other forums
that give solutions such as the name of the script, which is parse_Money.py,
and i have tried doing it with urllib.request.urlopen AND i have tried running
it on python 2.5, 2.6, and 2.7. If anybody has any suggestions it would be
really welcome, thanks everyone!! \--Matt

\---_EDIT_ \--- I also tried this code and it worked, so im thinking its some
kind of syntax error, so if anybody with a sharp eye can point it out, i would
be very appreciative.

    
    
    import shutil
    import os
    import os.path
    import time
    import datetime
    import math
    import urllib
    from array import array
    import random
    b = 3
    
    #find URL
    URL = raw_input('Type the URL you would like to read from[Example: http://www.google.com/] :')
    
    
    
    while b == 3:
        #get file name
        file1 = raw_input('Enter a file name for the downloaded code:')
        filepath = file1 + '.txt'
        if os.path.isfile(filepath):
            print 'File already exists'
            b = 3
        else:
            print 'Filename accepted'
            b = 4
    
    file_path = filepath
    #open file
    FileWrite = open(file_path, 'a')
    
    
    #acces URL
    filehandle = urllib.urlopen(URL)
    
    #display souce code
    for lines in filehandle.readlines():
        FileWrite.write(lines)
        print lines
    print 'The above has been saved in both a text and html file'
    
    #close files
    filehandle.close()
    FileWrite.close()
    


Answer: [it appears](http://docs.python.org/py3k/library/urllib.request.html) that the
`urlopen` method is available in the `urllib.request` module and not in the
`urllib` module as you're expecting.

rule of thumb - if you're getting an `AttributeError`, that field/operation is
not present in the particular module.

**EDIT** \- Thanks to AndiDog for pointing out - this is a solution valid for
Py 3.x, and not applicable to Py2.x!

