>>> ac="mmjj" >>> aaa="adfbvbad{}".format(ac) >>> aaa 'adfbvbadmmjj' >>> aaa="adfbvbad{}aaa{}".format(ac) Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> aaa="adfbvbad{}aaa{}".format(ac) IndexError: tuple index out of range >>> aaa="adfbvbad{}aaa{}".format(ac,ac) >>> aaa 'adfbvbadmmjjaaammjj' >>>
标签:adfbvbad,ac,aaa,format,python,字符串,替换 From: https://www.cnblogs.com/xkdn/p/16929039.html