1. 程式人生 > 其它 >TypeError: not all arguments converted during string formatting解決方法

TypeError: not all arguments converted during string formatting解決方法

技術標籤:Pythondjangopython

TypeError: not all arguments converted during string formatting解決方法

    def __str__(self):
        return u'Movie:%s'%(self.mid,self.mname)

報錯原因:python格式化輸出時前後引數個數不一致
對比前後引數發現引號內只有一個%s,而後面卻有倆個引數所以報錯