0

i use a string str1= { 0xFEFE 0x0111 0x00 }, { 0xFEFE 0x0112 0x01 }, { 0xFEFE 0x0113 0x01 },{ 0xFEFE 0x0114 0x00 }
need to find and seperate the substrings that end with 0x00 in one list and the substrings that end with 0x01 in another list.
could anyone please help me to write a python script.

2
Contributors
5
Replies
54
Views
3 Years
Discussion Span
Last Post by sruthiashok
0

that doesn't work..can u provide me a solution without using the default function

0
lst = re.findall(r"0xFEFE.*0x01 }",str1)
print(lst) 

output:

['0xFEFE 0x0111 0x00 }, { 0xFEFE 0x0112 0x01 }, { 0xFEFE 0x0113 0x01 }']

lst = re.findall(r"0xFEFE.*0x00 }",str1)
print(lst) 

ouput:

['0xFEFE 0x0111 0x00 }, { 0xFEFE 0x0112 0x01 }, { 0xFEFE 0x0113 0x01 }, { 0xFEFE 0x0114 0x00 }']

this is the result iam getting...please somebody could correct this

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.