Greetings:

My UDP client is receiving responses from the server, and now I need to
process them.  A typical response string looks like this:

    "(0, ''),some data from the test system"

The tuple represents the error code and message.  If the command had failed,
the response would look like this:

    "(-1, 'Error message from the test system')"

I need to extract the tuple from the rest of the response string.  I can do
this using eval, like so: 

    errtuple = eval(mytxt[:mytxt.find(')')+1])

Is there another, more specific method for transforming a sting into a
tuple?

Thanks as always.  

Barry


_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to