Python Forum
How do I mask Hex value wiht 0xFF?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I mask Hex value wiht 0xFF?
#1
Hello ,
I have this list
My List ['0x5b', '0x1ab', '0x282', '0x140', '0x6d7', '0x170']
0x5b<class 'str'>
0x1ab<class 'str'>
0x282<class 'str'>
0x140<class 'str'>
0x6d7<class 'str'>
0x170<class 'str'>
I want\need to maks all values with 0xFF

so the finall list will be
0x5b
0xab
0x82
0x40
0xd7
0x70
*********
there is no way to delete this post , I have found how to do it

while i < 6:
    temp= int(MyList[i], 16)
    temp = temp & int(0xff)
    MyList[i] = hex(temp)
    print(MyList[i])
    i += 1
Thanks,
Reply


Messages In This Thread
How do I mask Hex value wiht 0xFF? - by korenron - Nov-23-2021, 09:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using boolean mask in Numpy for 3D IlikePi 0 1,556 Nov-14-2020, 10:08 PM
Last Post: IlikePi
  Saving a mask as a png file in opencv DanTheMan 1 5,739 Jan-31-2020, 09:20 AM
Last Post: ThiefOfTime
  Subnet Mask Ranges ab52 0 1,849 Mar-11-2019, 10:39 AM
Last Post: ab52
  Create a List for Boolean Mask. leoahum 4 3,976 Oct-09-2018, 02:38 PM
Last Post: leoahum
  python script to get wildcard mask output in the following format techrichit 0 3,859 Aug-10-2018, 11:01 PM
Last Post: techrichit
  Mask superclass __init__ fig0 5 3,911 Jan-11-2018, 06:59 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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