For this tutorial, we will be taking the data from the command line. To do this, we will use the sys module, so add to the same line ", sys". The import line should now read as follows:
import MySQLdb, sysIf you are doing this in the Python shell, simply type:
>>> import sysPython will not be bothered by the late addition.
Then define two variables, id and input, according to the sys.argv[] arguments:
id = sys.argv[1]This tells Python that the first argument after the program's name should be assigned to the variable 'id'. Likewise, the second argument gets assigned to 'input'.
input = sys.argv[2]
