query domain registry from python?
hi, does anyone know of a library that can query domain registry or any site that provide information to such an activity? as i want to build a simple domain name searching program for my own benefit.. thanks alot :D -- http://mail.python.org/mailman/listinfo/python-list
fetching images from web?
hi, i want to automate some tasks of gathering photos from web, i tried urllib/urllib2, both ended up without much success (saved gifs with only a border, nothing else).. the code i used was: >>> data = >>> urllib2.urlopen("http://aspn.activestate.com/ASPN/img/komodo_aspn_other.gif";) >>> #was looking through cookbook, so i used that as a sample image >>> data = data.read() >>> file = open("f:/test.gif", "w") >>> file.write(data) >>> file.close() can someone suggest a better way (or what's wrong with urllib/urllib2)? thanks alot! -- http://mail.python.org/mailman/listinfo/python-list
Re: fetching images from web?
ah, wb works :D thanks alot! -- http://mail.python.org/mailman/listinfo/python-list
recursive function return value problems
hi, i have the following recursive function (simplified to demonstrate the problem): >>> def reTest(bool): ... result = [] ... if not bool: ... reTest(True) ... else: ... print "YAHHH" ... result = ["should be the only thing returned"] ... print "printing result: " ... print result ... return result ... >>> reTest(False) YAHHH printing result: ['should be the only thing returned'] printing result: [] [] I don't understand why results are returned twice? is there something special i missed about recursive functions? -- http://mail.python.org/mailman/listinfo/python-list
Re: recursive function return value problems
the final returned value is: [] the two values printed is (note i only have one print statement printing "print result",. however, in the actualality, it's printed twice): printing result: ['should be the only thing returned'] printing result: [] therefore, sadly, i don't thinkg you've understand my problem correctly.. -- http://mail.python.org/mailman/listinfo/python-list
Re: recursive function return value problems
ah, result = reTest(True) works, thanks alot :D -- http://mail.python.org/mailman/listinfo/python-list
download full sites?
hi, does anyone know of any package that will download a full site for offline viewing? It will change all url to match local urls and follow a logical structure (the site's structure would be suffice).. Please tell me if you have heard of such a package.. thanks alot :D -- http://mail.python.org/mailman/listinfo/python-list
TypeError: 'module' object is not callable
Hello everyone! i have the following test code: class temp: def __init__(self): self.hello = "hello world!" def printworld(self): print(self.hello) t = temp() and i tried to call profile('t.printworld()') but i received the following error: Traceback (most recent call last): File "", line 1, in ? TypeError: 'module' object is not callable I'm not sure what is wrong exactly, if anyone can point me to the right direction, it would be much appreciated! -- http://mail.python.org/mailman/listinfo/python-list
append function problem?
hello, recently i tried to use list.append() function in seemingly logical ways, however, i cannot get it to work, here is the test code: >>> seed = [2, 3, 4, 5] >>> next = 7 >>> seed1 = seed.append(next) >>> seed1 >>> print(str(seed1)) None >>> def test(lst): ... print(str(lst)) ... >>> test(seed.append(next)) None I'm using Activestate python (latest) on win xp sp2.. I'm not sure why seed1 and the function doesn't recognize the list.. If anyone can point out where i'm going wrong would be much appreciated! Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list
opposite function to split?
hello everyone! I can't seem to find a function that combines a list of items into a string with a seperator between the individual elements.. Is there such a method that does the opposite of sting.split? thanks alot! -- http://mail.python.org/mailman/listinfo/python-list
returning none when it should be returning a list?
hello, i have another problem i feel that i have to be missing something.. Basically, i've written a recursive function to find all the prime up to a number (lim).. here is the function: The function basically takes in a list of all the prime number found, it takes the next number to be tested for (next) and the limit it will go up to. It divide next by the list of previous prime numbers if next is not bigger than lim, count up all the times where it's not evenly divdided, if the result is equal the length of prime number, then we have another prime number, lather rinse and repeat :) def findPrime(seed, next, lim): print("seed: " + str(seed) + " next: " + str(next) + " lim: " + str(lim)) print(seed) if(next >= lim): print(seed) return seed else: count = 0; for num in seed: modu = math.modf(float(next)/float(num)); if(modu[0] > 0): count += 1 if(count == len(seed)): seed.append(next) findPrime(seed, next+2, lim) else: findPrime(seed, next+2, lim) As you can probably see, i've printed the value of seed up until the point where i'm returning the seed, however, the function still returns None.. -- http://mail.python.org/mailman/listinfo/python-list
Re: returning none when it should be returning a list?
John Machin wrote: > > That's because it "falls off the end" of the function, which causes it > to return None. However that's not your only problem. Major other > problem is updating "seed" in situ. > I'm not sure what "falls off the end" of the function means, i searched online, it seems to mean that the function has reached the end prematurely and returned a default identifier to signal success or not.. Can you please explain what that means? Other than that, thanks alot for all those who posted! It's been very educational! -- http://mail.python.org/mailman/listinfo/python-list