python - 如何在正则字符串中使用format()
PHP中文网
PHP中文网 2017-04-18 09:58:49
0
2
353
PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
Peter_Zhu

In the format string, use '{{' to change to { , '}}' to change to }

Your example can be written like this:

"\d{{5}}_{name}_aaa".format(name=name)
左手右手慢动作

Is this necessary?

Regular expressions are much more expressive than format, so there is no need to add superfluous information~

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!