mercredi 25 mars 2015

How to use a % after %s in python? [duplicate]


This question already has an answer here:




My problem boils down to:



# examplecode
# i want to achieve the string "1.1%"

s = '%s%' % '1.1'
# but this throws me a
ValueError: incomplete format


ofc i could just use format()



s = '{}%'.format('1.1')


but is there a way to use a % after a %s ?


Aucun commentaire:

Enregistrer un commentaire