encode(format, value1, ...)
The encode function takes a list of arguments and stores them into an efficient binary string representation based on the format specification. The encode/decode functions are similar to the pack/unpack functions in Perl. See the decode_format specification section of this chapter for information on the format characters.
Example
str = encode("iiiZ", 111, 222, 333, "this is a string")