【发布时间】:2012-09-18 01:52:45
【问题描述】:
可能重复:
Is there an easy way to return a string repeated X number of times?
在 Python 中,您可以像这样将序列相乘
fivespaces= ' ' * 5
在 C# 中是否有任何内置的等效项? (没有运算符重载或类扩展)
【问题讨论】:
-
@AhmadMageed -- 我不确定我是否同意这是重复的。在我看来,字符串只是一个例子。 python 也有其他序列类型(如列表):
five_spaces_in_a_list = [' ']*5