%d converts the value to int first which might be useful:
>>> '%d' % 3.14
'3'
>>> '%d' % 'foo'
TypeError: %d format: a number is required, not str