[BangPypers] Python place holder doubt

Pradeep Gowda pradeep at btbytes.com
Wed Nov 11 19:11:05 CET 2009


On Wed, Nov 11, 2009 at 12:47 PM, JAGANADH G <jaganadhg at gmail.com> wrote:
> url = self.BASEURL + "pmid=%d" + "&tag=ntag&type=ge" %d

Did you mean:
 url = self.BASEURL + "pmid=%d" % (d, ) + "&tag=ntag&type=ge"  ?

Even though this might fix your problem, don't use it.

To encode URLs always use urlencode: http://docs.python.org/library/urllib.html
which is part of the standard library.

Using "+" to concat more than two strings is definitely unpythonic.

Also:
Do NOT cross post to multiple lists.


More information about the BangPypers mailing list