天天看點

TypeError: unsupported operand type(s) for &: 'str' and 'int'

今天在寫一個很簡單的程式時出現了一個錯誤:

TypeError: unsupported operand type(s) for &: 'str' and 'int'

按照錯誤描述,做出以下嘗試:

TypeError: unsupported operand type(s) for &: 'str' and 'int'

這樣是對的,是以問題就在後半部分。再做嘗試:

TypeError: unsupported operand type(s) for &: 'str' and 'int'

這樣就對了,是以一定要加括号,括号不可丢。