From the page where this code seems to be from:
The value field of the response object will contain a list of tuples, where each tuple contains the DTC, and a string description of that DTC (if available).
So if r = connection.query(obd.commands.GET_DTC)
, then r.value
is a "list of tuples". You can use the zip() function (as described in this question) to transpose the structure with zip(*r.value)
which gives
[('P0030', 'P1367'), ('HO2S Heater Control Circuit', 'Unknown error code')]
You just want the second element of this list, so
zip(*r.value)[1]
gives you the tuple
('HO2S Heater Control Circuit', 'Unknown error code')
You could then use this as you wish. Notice that this gives you all of the "second values in each outputted item". You could iterate through all them (and, say print each one) with:
for description in zip(*r.value)[1]:
print description
It may be a good idea to assign zip(*r.value)[1]
to a variable if you want to use it more than once.