Use int() with str.split() :
In [31]: s='20 01' In [32]: int("".join(s.split()),16) Out[32]: 8193
or str.replace() and pass the base as 16:
In [34]: int(s.replace(" ",""),16) Out[34]: 8193
Here both split() and replace() convert '20 01' to '2001' :
In [35]: '20 01'.replace(" ","") Out[35]: '2001' In [36]: "".join('20 01'.split()) Out[36]: '2001'
source share