Q:

read value from file then pass value in sql UPDATE command(python script)

So hopefully an easy question although I'm having trouble putting it together using google.   I have a windows application that writes values to a text file which I need to pull from text and send to mysql.   I can manually do everything I need but having trouble pulling the value from the text file and sending it to sql in an update statement(won't accept variables).   Please let me know if there is a way to use variables in my UPDATE statement. 
the data variable is what I'm trying to pass.   
Code below:
#! /usr/bin/python

import MySQLdb

file = open('tvalue.txt', 'r')
data = file.read()

# Open database connection
db = MySQLdb.connect("localhost","testuser","test123","TESTDB" )
# prepare a cursor object using cursor() method
cursor = db.cursor()

cursor.execute("UPDATE table1 SET waiting=data where dept='billing'" )

    # Commit your changes in the database
db.commit()

# disconnect from server
db.close()

A:

c.execute("UPDATE table1 SET waiting=%s where dept='billing'", (data.strip(),))

Should do the trick. 
Take a look to the first example at http://dev.mysql.com/doc/connector-python/en/connector-python-example-cursor-select.html
And remember not to use concatenation to avoid SQL Injection. 
If you don't want waiting to contain any new line or spaces at the beginning or end use strip. 
EDIT: the query has to be a tuple, in this case, consisting in a single value, a , is needed.