不同于整数的+和* 字符串+字符串是把两个字符串直接连起来,字符串*整数n,就是打印n遍字符串
>>> a = 'abc'
>>> b = 'xyz'
>>> a + b
'abcxyz'
>>> a + ' ' + b
'abc xyz'
>>> a * 10
'abcabcabcabcabcabcabcabcabcabc'
>>> c = 10
>>> c * 10
100
>>> c = '10'
>>> c * 10
'10101010101010101010'
>>> a = 'abc'
>>> b = 'xyz'
>>> a + b
'abcxyz'
>>> a + ' ' + b
'abc xyz'
>>> a * 10
'abcabcabcabcabcabcabcabcabcabc'
>>> c = 10
>>> c * 10
100
>>> c = '10'
>>> c * 10
'10101010101010101010'
编辑回复