#!/usr/bin/env python string='test' hexlist=[] for i in range(0,len(string)): hexlist.append(hex(int(string[i:i+1].encode('hex'),16))) print hexlist