Pass parameter one time, but use more times

Posted by Gabriel L. Oliveira on Stack Overflow See other posts from Stack Overflow or by Gabriel L. Oliveira
Published on 2010-06-04T23:18:48Z Indexed on 2010/06/05 9:32 UTC
Read the original article Hit count: 248

Filed under:
|
|

I'm trying to do this:

commands = { 'py': 'python %s', 'md': 'markdown "%s" > "%s.html"; gnome-open "%s.html"', }

commands['md'] % 'file.md'

But like you see, the commmands['md'] uses the parameter 3 times, but the commands['py'] just use once. How can I repeat the parameter without changing the last line (so, just passing the parameter one time?)

© Stack Overflow or respective owner

Related posts about python

Related posts about parameters