Python Forum
help coding for decode filtering
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help coding for decode filtering
#1
I have original code like this below
        if line[15:20] == 'Rx RF':

            # decode RF message. format is:
            #   02/13 23:54:28 Rx RF HouseUnit: B1 Func: On
            line_list = line.split(' ')
            house_code = line_list[5];
            house_func = line_list[7]

            return house_code, {'func': house_func}, 'button'
Like in description, if input "02/13 23:54:28 Rx RF HouseUnit: B1 Func: On"
this code will decode :
house_code = B1
house_func = On

Now I have 2 lines input :
02/13 23:54:28 Rx PL HouseUnit: A1
02/13 23:54:28 Rx PL House: A Func: On

I want to modify the code so that will have result :
house_code = A1
house_func = On

Anybody can help me?
Reply


Messages In This Thread
help coding for decode filtering - by dony71 - Jun-29-2018, 01:05 AM
RE: help coding for decode filtering - by scidam - Jun-29-2018, 04:18 AM
RE: help coding for decode filtering - by dony71 - Jun-29-2018, 07:19 PM
RE: help coding for decode filtering - by volcano63 - Jun-29-2018, 08:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Decode string ? JohnnyCoffee 1 936 Jan-11-2023, 12:29 AM
Last Post: bowlofred
  how to encode and decode same value absolut 2 2,509 Sep-08-2020, 09:46 AM
Last Post: TomToad
  struct.decode() and '\0' deanhystad 1 3,421 Apr-09-2020, 04:13 PM
Last Post: TomToad
  Getting decode error. shankar 8 10,725 Sep-20-2019, 10:05 AM
Last Post: tinman
  how to decode UTF-8 in python 3 oco 3 37,673 Jun-05-2018, 11:05 AM
Last Post: wavic
  Ask help for utf-8 decode/encode forfan 12 11,314 Feb-25-2017, 02:04 AM
Last Post: forfan

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020