[BangPypers] Python place holder doubt

Aravind Muthu aravind.geek at gmail.com
Thu Nov 12 09:04:16 CET 2009


url = self.BASEURL + "pmid=%d" + "&tag=ntag&type=ge" %d


Try this ..i dont know exactlly correct or not.....

url=self.BASEURL
final=+ "pmid=%d" + "&tag=ntag&type=ge" %d
urlparse.urljoin(url,final)


Aravind.

On 11/12/09, JAGANADH G <jaganadhg at gmail.com> wrote:
> 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
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list