Commit 9fc2a2b2 authored by Eric Coissac's avatar Eric Coissac

Add to basic conversion function between str and bytes

parent 21285286
from ._progress import progressBar
def str2bytes(string):
Short cut to convert ascii encoded python string (str) to bytes
which can be easily converted to C-strings.
@param string: the python string to be converted.
@type string: str
@return a transcoded string
@rtype: bytes
return string.encode('ascii')
def bytes2str( string):
Short cut to convert bytes (C-strings) to ascii encoded python string (str).
@param string: the binary (C-string) string to be converted.
@type string: bytes
@return an ascii transcoded string
@rtype: str
return string.decode('ascii')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment