Ok so I am attempting to make a program that downloads files from a site that are similarly named. For example, there is a site with files that are named blarg-0001, blarg-0002, blarg-0003, etc, until blarg-0020. Well the purpose of my code is to download those and everything inbetween but I am getting an error and I am so confused right now I dont know what my code actually does any more...

def menu():
    global a
    global b
    global c
    global h
    global d
    global e
    a = raw_input("www.###.com/ Pt.1:")
    b = raw_input("###/ Pt.2:")
    c = raw_input("something-00 Pt.3:")
    d = input("starting# Pt.4:")
    e = input("ending# Pt.5:")
    h = raw_input("file extention Pt.6:")
    menu = raw_input("Finished? (Y/N)")
    if menu == "y":
        downloadcount()
    elif menu == "n":
        menu()
    else:
        print "Invalid Input"
        pass
    
    

def downloadcount():
    import urllib
    global a
    global b
    global c
    global h
    global d
    global e
    z = a,b,c,d,h
    while e >= d:
        print "File",d,"complete..."
        urllib.urlopen(z)
        g = f.read()
        file = open("test%d.txt", "w") %d
        file.write(g)
        file.close
        d += 1

Sorry, nevermind >.<
I feel really stupid since the answer was a lot more obvious than I thought it was. Solv'd

PM me if anyone is curious about the code

This question has already been answered. Start a new discussion instead.