[BangPypers] Python place holder doubt

JAGANADH G jaganadhg at gmail.com
Wed Nov 11 19:32:33 CET 2009


On Wed, Nov 11, 2009 at 11:41 PM, Pradeep Gowda <pradeep at btbytes.com> wrote:

> 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.
>
> Thanks
-- 
**********************************
JAGANADH G
http://jaganadhg.freeflux.net/blog

Sent from Chennai, TN, India


More information about the BangPypers mailing list