Converting String to Class

michael michael.bierenfeld at web.de
Wed Dec 1 11:58:04 EST 2004


Hello,

I have a script that is called by the shell this way :

mqtrigger.py "TMC    2TEST.QUEUE     LV1871.MQPROCESS"

So argv[1] is the string "TMC    2TEST.QUEUE     LV1871.MQPROCESS"

I would like to construct a class with that string that contains the
attributes

-StrucId
-VersionId
-QName
-ProcessName

I am thinking about using the following info

opts = [['StrucId', CMQC.MQTMC_STRUC_ID, '4s'],   
        ['Version', CMQC.MQTMC_VERSION_2, '4s'],
        ['QName', '', '48s'],                       ## or less :-)
        ['ProcessName', '', '48s']]                 ## or less :-)

1. is the attributename
2. is the default
3. is the format in the string

So the string could be parsed with the opts Info and the attributes
could be inserted into the class. I dont even have a starting point
how to do that. Could somebody point my into the right direction

Regards

Michael



More information about the Python-list mailing list