0

Hello I am learning PYTHON and was learning about string splitting .so I have a hex string named

A="aca80202"

I want to convert it into a list of 2 characters

B=["ac","a8","02",02"]

is there any way to do it?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

0

If you are starting with Python you could do it in a simple way using a for loop:

A="aca80202"
B = []
for i in range(0, len(A), 2):
    B.append(A[i:i+2])

EDIT: you could see more ways to do it here.

Community
  • 1
  • 1
kikocorreoso
  • 3,999
  • 1
  • 17
  • 26