Python common error messages -TypeError- str conv
TypeError: not all arguments converted during string formatting
class tables:
def __init__(self,w):
# 2.4 Definitions of tables for the FSM
ans = self.T0_r(w)
print "Result =" % (ans)
def T0_r(self, w):
self.tables_ls()
self.w = w
self.s1_t0_r = self.T0[self.w]
return self.s1_t0_r
def tables_ls(self):
self.T0 = ['0xFF563C6' ,'0x84FF7CF8' ,'0x897788EE' ,'0x8EFB7BF6',
'0xFE2F2FF ' ,'0xBCAF6BD6' ,'0xAA6F6FDE' ,'0xFFC5C591']
def main ():
# Read 0 elemant of the table array by calling class
y = tables(0x4)
main()
File "calling_classes.py", line 28, in ?
main()
File "calling_classes.py", line 26, in main
y = tables(0x4)
File "calling_classes.py", line 12, in __init__
print "Result =" % (ans)
ypeError: not all arguments
Instead off
print "Result =" % (ans)
use
print "Result =%s" % (ans)