如何在python中的%s之后使用%?

yam*_*amm 2 python string

我的问题归结为:

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

s = '%s%' % '1.1'
# but this throws me a
ValueError: incomplete format
Run Code Online (Sandbox Code Playgroud)

我可以使用ofc format()

s = '{}%'.format('1.1')
Run Code Online (Sandbox Code Playgroud)

但是有没有办法在a %之后使用a %s

the*_*eye 5

逃生%与另一个%,这样

>>> s = '%s%%' % '1.1'
>>> s
'1.1%'
Run Code Online (Sandbox Code Playgroud)