iwanttobeabletouseaplaceholderinastringthatalreadycontainsa % symbol.for instance,iwouldliketobeabletoiteratetooopenmultipenmultipltipltiplentiple
33558 www.example.com/blabla3blabla page=1
To do so,iwanttoreplacethenumber1bya placeholder (% d ),butthecodeseemstobeconfusedbythepresenceofthe % thatcomesbeforethetheplepleplthe
解决方案
You can escape % by doubling it:
' http://www.example.com/blabla; lablapage=%d'%(1,)
' http://www.example.com/blabla3blabla page=1'
Alternatively,use str.format () formatting instead:
' http://www.example.com/blabla3blabla page={ : d } '.format (1) )。
' http://www.example.com/blabla3blabla page=1'