So let's say I have this line of text 0x730x700x770x770x7a. As some of you might have noticed, those are multiple hex numbers bunched together. What I want is a way to remove the 0x prefix despite the position it is on the line of text. Take in mind that the above line of multiple hex values is just an example. My goal after removing the prefix is to put every different hex value inside a list and turn them into ASCII. Any advice would be appreciated because I don't have much knowledge with Python.

🔴 No definitive solution yet
📌 Solution 1

Don't remove the prefixes. Use built-in Python facilities to get your list of integers directly.

>>> a = "0x730x700x770x770x7a"
>>> list(int(a[i:i+4],16) for i in range(0,len(a),4))
[115, 112, 119, 119, 122]
📌 Solution 2

Try the following:

num = "0x730x700x770x770x7a"
lst = num.split("0x")[1:]
asciilst = []

for x in lst:
  bytes_object = bytes.fromhex(x)
  ascii_string = bytes_object.decode("ASCII")