我目前正在编写一个进行频率分析的短程序.然而,有一条线困扰着我:
"{0[0]} | " + "[]" * num_occurrences + " Total: {0[1]!s}"
在Python中有没有一种方法可以重复某些字符而不需要连接(最好是在格式字符串中)?我不觉得我是以最恐怖的方式做这件事.
python string concatenation format-string
concatenation ×1
format-string ×1
python ×1
string ×1