Question: I have a list that is the `a=[0,1]` and I want to change with `a=[0x00,0x001]` type. How can I do this? I tried this way 

```
print (struct.pack('>h',a))

```

But I cannot change to hex

Answer: 
As you fail to describe what your wanted outcome is, I can only guess:

1. Do you want to pack some numbers to a string?

Then it doesn't matter which format you use, both should work as soon as you use the correct format string:

```
a = [1, 2]
b = [0x01, 0x02]
struct.pack(">hh", *a)
# > '\x00\x01\x00\x02'
struct.pack(">hh", *b)
# > '\x00\x01\x00\x02'

```

This is because `a` and `b` are equal: it doesn't matter if you write `1` and `2` or if you prefer `0x01` resp. `0x02`. Be aware that the displayed strings are just representations of strings containing special characters with the values 0, 1 and 2, respectively.
2. Do you want to output your numbers in a hexadecimal representation?

In this case, see the other answers.
Below is the another way of converting you list of integer to list of hex

```
a = [0,1]
b = map(hex, a) 
# or 
b = map(lambda x:hex(x), a)
# output
print b
['0x1', '0x2']

```