Python list formatting I have a list, which looks like this:

params
['h\x00i\x00', '\x00t\x00h\x00e\x00r\x00e\x00']


Now, all I want is to merge these two elements into the string "hi there", but when I use

print ' '.join(params)


I get

h i  t h e r e


How do I strip out those hex characters to make the string "hi there"?
You have the null equivalent hexadecimal '\x00' in between each character. To remove those hexadecimal characters, first join the list with a space and then split it at '\x00' and then join again. Print statement simply looks like follows.

&gt;&gt;&gt; print(' '.join( ' '.join(params).split('\x00')))