我试图去除正在打印的括号。圆括号内的Python间距
这里是我的打印功能
print("The text contains", totalChars, "alphabetic characters of which", numberOfe, "(", percent_with_e, "%)", "are 'e'.")
它打印出这样的
The text contains 5 alphabetic characters of which 5 (100.0 %) are 'e'.
但我需要它来打印这样
The text contains 5 alphabetic characters, of which 5 (100.0%) are 'e'.
唯一的区别似乎是间距围绕括号。我无法获得从一开始就被删除的空间。
这听起来像你需要字符串格式。 –