[IronPython] How to convert a 'str' type to byteArray
matan504 at gmail.com
Wed Nov 11 16:14:29 CET 2009
I have the following code which gets an image from an email.
after getting it i need to pass it as a byteArray (byte in C#) to a C#
i tried all sorts of things but no luck. I'm using ironPython 2.0.3
the important parts of the code are:
# getting the image from the e-mail
image = part.get_payload()
# my try to cast the str into a byteArray
byteArray = BitConverter.GetBytes(image.ToCharArray())
this last line returns 1 byte and doesn't seem to do the job.
is there any equivalent to the 'bytearray(image)' function in CPython?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users