I am using 2.5 on GAE using some of the Crypto modules from gdata python modules. I am able to use hashAndSign on a string, but the function returns an array.array of ‘B’ unsigned characters.
I’m still experimenting on getting it all together, but one thing I’m stumbling on now is getting an:
array('B', [120, 231, 49, 2, 125, 143, 213, 14, 214, 66, 52, 11, 124, 154, 99, 179])
to be a string representation like:
'x\xe71\x02}\x8f\xd5\x0e\xd6B4\x0b|\x9ac\xb3'
How can I get the array to be a string like that?
I know this is a simple thing, but it is stumping me.
I need this so I can do a .encode(‘base64’) to send to my client app which hopefully will be able to use it to verify the string I signed.
Your question title “Python 2.5 version of array.array.tostring()?” is puzzling. The
tostring()method ofarray.arrayobjects has been available for a very long time:Aside: Yes, that’s right, once upon a time,
repr()did octal, not hex.What did you actually try in Python 2.5? What was the outcome? Copy/paste the full stack trace and error message into an edit of your question.