The question is simple: How do I repeat a string
in Python?
I'm used to PHP.
When I want to repeat a string in PHP, I do so:
var $str = 'StackOverflow';
str_repeat($str, 5);
// Imprime: StackOverflowStackOverflowStackOverflowStackOverflowStackOverflow
I tried this:
'StackOverflow'.repeat(5);
However an error is returned:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'repeat'