python accessing super class variable in child class [closed]

You accessed the super class variable correctly; your code gives you an error because of how you tried to print it. You used . for string concatenation instead of +, and concatenated a string and a list. Change the line

    print "Value of x = ". self.x

to any of the following:

    print "Value of x = " + str(self.x)
    print "Value of x =", self.x
    print "Value of x = %s" % (self.x, )
    print "Value of x = {0}".format(self.x)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)