I am trying to extract strings in Python received by a function.
Consider the following;
I have a script that runs in Python. The script runs continuosly. It binds to a USB port and listens for incoming ZigBee data frames.
I have a function that dissassembles this dataframe;
# Decoded data frame to use later on
def decodeReceivedFrame(data):
source_addr_long = toHex(data['source_addr_long'])
source_addr = toHex(data['source_addr'])
id = data['id']
rf_data = data['rf_data']
#samples = data['samples']
return [source_addr_long, source_addr, id, rf_data]
When I print this function later on; it gives me the correct incoming values. For example;
decodedData = decodeReceivedFrame(data)
print decodedData
Output:
[None, None, 'rx', '<=>\x80\x02#387239766#XBEE#126#STR:wm2 #STR:c47cb3f57365#']
What I want to do, is to extract the two STR variables of this string. This means the wm2 String, and the c47cb3f57365 string, in two seperate variables.
Which function in Python would be the most efficient to solve this situation?