How to print a string two times with single statement in Python?



When used with strings, asterisk (*) is defined as repetition operator. It concatenates given string as many times as number followed by asterisk.

>>> string = 'abcdefghij'
>>> print (string*2)
   abcdefghijabcdefghij

Advertisements