Python學習筆記(0)
# 字串與數字相加,報錯 >>> 'I love Python' + 5 Traceback (most recent call last): File "<pyshell#7>", line 1, in <module> 'I love Python' + 5 TypeError: Can't convert 'int' object to str implicitly # 字串與字串相乘,報錯 >>> 'I love Python!' * 'love' Traceback (most recent call last): File"<pyshell#40>", line 1, in <module> 'I love Python!' * 'love' TypeError: can't multiply sequence by non-int of type 'str' # 字串相減,報錯 >>> 'I love Python!' - 'love' Traceback (most recent call last): File "<pyshell#41>", line 1, in <module> 'I love Python!' - 'love' TypeError: unsupported operand type(s) for -: 'str' and 'str' # 字串相除,報錯 >>> 'I love Python!' / 3 Traceback (most recent call last): File "<pyshell#42>", line 1, in <module> 'I love Python!' / 3 TypeError: unsupported operand type(s) for /: 'str' and 'int'