B is a tuple if it's assigned that way. Tuples are immutable. To make a list instead, you need square brackets: B = ['\x12', '\x32'] Regarding your original post, you'll probably have to ask more specific questions if you want to get good answers.