main.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:autopen 作者: autopen 项目源码 文件源码
def playback(self, table):
        if(self.VEHICLE_NAME == ""):
                self.TextArea.insert(END, "Please register/log in to a vehicle.\n")
                return

        # Open database connection
        db = MySQLdb.connect("localhost","root","toor",self.VEHICLE_NAME )
        # prepare a cursor object using cursor() method
        cursor = db.cursor()

        sql = "SELECT * FROM %s ;" % table
        count = 0

        try:
            # Execute the SQL command
            cursor.execute(sql)
            # Update the Treeview
            # Fetch all the rows in a list of lists.
            results = cursor.fetchall()

            for row in results:
                cmd = "cansend %s %s#%s.%s%s.%s%s%s%s.%s" % (q.get(), row[1], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10])
                for line in execute([cmd]):
                    count = count + 1

            # Commit your changes in the database
            db.commit()
        except:
            # Rollback in case there is any error
            db.rollback()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号