Old format with %

ast none at gmail.com
Wed Feb 14 07:54:56 EST 2018


Le 14/02/2018 à 13:46, ast a écrit :
> Hello
> 
> It seems that caracter % can't be escaped
> 
>  >>>"test %d %" % 7
> ValueError: incomplete format
> 
>  >>>"test %d \%" % 7
> ValueError: incomplete format
> 
>  >>>"test %d" % 7 + "%"
> 'test 7%'  # OK
> 
> But is there a way to escape a % ?
> 
> thx

Found, double % to escape it

 >>>"test %d%%" % 7
'test 7%'



More information about the Python-list mailing list