A = 3, B = bar. C=5. Unlike sprintf, you just pass a string to buf.write, formatting it with the % operator or the format method of strings. You could of course define a function to get the sprintf interface you're hoping for: def sprintf(buf, fmt, *args): buf.write(fmt % args) which would be used like this: More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.