Can someone please tell me why this class wont work.

#!/usr/bin/python
import MySQLdb

class test:
     @staticmethod
     def wanker():
         # connect
         db = MySQLdb.connect(host = "localhost", user = "username", passwd = "Password", db = "test")
         # create a database cursor
         cursor = db.cursor(MySQLdb.cursors.DictCursor)

         # execute SQL select statement
         cursor.execute("SELECT * FROM Threshold")

         Results = cursor.fetchall()
         return Results
        

x = test()
adam =  x.wanker()
print adam

nothing is returned :(

Recommended Answers

All 4 Replies

******() is not allowed as a function name. A function name has to start with a letter or an underscore and can contain numbers.

they are not ***** its because the function is a naught word that has been blocked out by the forum

may be it's blocked by a secret hook of the python interpreter too !

i have tried a normal name as well and still nothing. I have no idea and its rather annoying

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.