String formatting named parameters?

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2010-03-16T02:50:31Z Indexed on 2010/03/16 6:06 UTC
Read the original article Hit count: 487

Filed under:
|
|

I know it's a really simple question, but I have no idea how to google it.

how can I do

print '<a href="%s">%s</a>' % (my_url)

So that my_url is used twice? I assume I have to "name" the %s and then use a dict in the params, but I'm not sure of the proper syntax?


just FYI, I'm aware I can just use my_url twice in the params, but that's not the point :)

© Stack Overflow or respective owner

Related posts about python

Related posts about syntax