471,354 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Can you escape a % in string that will used for substitution

Is there a way to do:

s = "I like python %i%s of the time."
print s % (99, "%")

without having to pass in "%"?

Thanks,
Gerard
Oct 18 '07 #1
1 1267
On Thu, 18 Oct 2007 15:21:41 -0400, Gerard Brunick wrote:
Is there a way to do:

s = "I like python %i%s of the time." print s % (99, "%")

without having to pass in "%"?

Thanks,
Gerard
Just double-up the % sign, e.g. "I like python %i%% of the time."

Oct 22 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Steve Litvack | last post: by
6 posts views Thread by DDE | last post: by
3 posts views Thread by Ken | last post: by
4 posts views Thread by Guadala Harry | last post: by
5 posts views Thread by Murali | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.