I have a possibly quick question regarding how to write a program so it can decide how many variables need to be used.
here is code I have so far:
#!/usr/bin/python
from subprocess import PIPE, Popen
from os         import system
class TransMsg(object):
    def __init__(self):
        self.msgType = ""
        self.canType = ""
        self.ID      = 0
        self.DLC     = 0
        self.tData0  = 0
        self.tData1  = 0
        self.tData2  = 0
        self.tData3  = 0
        self.tData4  = 0
        self.tData5  = 0
        self.tData6  = 0
        self.tData7  = 0
        # extended can only
        self.tData8  = 0
        self.tData9  = 0
        self.tData10 = 0
        self.tData11 = 0
        self.tData12 = 0
        self.tData13 = 0
        self.tData14 = 0
        self.tData15 = 0
        self.count   = 0
def startTrans(msg):
    print( msg.ID, msg.tData0, msg.tData1, msg.tData2, msg.tData3, msg.tData4, msg.tData5, msg.tData6, msg.tData7)
def createMsg():
    msg = TransMsg()
    msg.msgType = raw_input("Please Enter Msg Type\n m = Message String Follows\n r = RTR-Message String Follows\n i = Initialsation String Follows\n")
    msg.canType = raw_input("Please Enter Can Type\n s = Standard Can\n e = Extended Can\n")
    msg.ID      = raw_input("Please enter message ID: ")
    if(msg.canType == 'e'):
        msg.DLC = 16
        extendedString = raw_input("Please enter can message:\n")
        cutter = extendedString.split()
        msg.tData0  = cutter[0]
        msg.tData1  = cutter[1]
        msg.tData2  = cutter[2]
        msg.tData3  = cutter[3]
        msg.tData4  = cutter[4]
        msg.tData5  = cutter[5]
        msg.tData6  = cutter[6]
        msg.tData7  = cutter[7]
        msg.tData8  = cutter[8]
        msg.tData9  = cutter[9]
        msg.tData10 = cutter[10]
        msg.tData11 = cutter[11]
        msg.tData12 = cutter[12]
        msg.tData13 = cutter[13]
        msg.tData14 = cutter[14]
        msg.tData15 = cutter[15]
    elif(msg.canType == 's'):
        msg.DLC = 8
        standardString = raw_input("Please enter can message:\n")
        cutter = standardString.split()
        msg.tData0  = cutter[0]
        msg.tData1  = cutter[1]
        msg.tData2  = cutter[2]
        msg.tData3  = cutter[3]
        msg.tData4  = cutter[4]
        msg.tData5  = cutter[5]
        msg.tData6  = cutter[6]
        msg.tData7  = cutter[7]
    return msg
if __name__ == '__main__':
    msg4Trans = createMsg()
    startTrans(msg4Trans)
What I need is if the use defines the DLC variable as for example 3 the program only needs to use tData1, 2, and 3. Is this possible within the context of my program?
Thanks
