[Tutor] str format conversion help

eMyListsDDg emylistsddg at gmail.com
Thu Jul 15 09:09:34 CEST 2010


thanks,
   

def conv_tst(bytes)
	
     return ('-'.join([binascii.hexlify(v) for v in bytes]))



i ended up experimenting with the suggestions and the above returns what i'm looking for, i.e., the formatted mac addr to store in a sqlite db. 

i'm sure there are other ways, though the above is working now.



mucho gracias all




> use de fucntion encode. For example:

> '\x7e\x00\x20'.encode('hex') will return that = '7e0020'  




More information about the Tutor mailing list