From here: just use a % sign as an escape character.
so:
People say this is hacky. They 'fixed' it in Python 3.0 but I'm not upgrading soon. Imagine having to go through all your code because of this nonessential thing!
so:
print '22%'
worksprint '%d' %(22)
worksprint '%d%' %(22)
throws an error and the solution isprint '%d%%' %(22)
People say this is hacky. They 'fixed' it in Python 3.0 but I'm not upgrading soon. Imagine having to go through all your code because of this nonessential thing!
This works.
ReplyDeleteThe problem is when you have to print "%" with localized strings.