Entry
Can I get the output of the uuencode() function into a string, instead of a file or stdout?
Jul 5th, 2000 10:00
Nathan Wallace, unknown unknown, Hans Nowak, Snippet 172, Fred L. Drake
"""
Packages: crypto;basic_datatypes.strings;text
"""
"""
> Is it possible to get the output of the uuencode() function
> into a string, instead of a file or stdout?
The output file can be a StringIO instance; a convenience function
to handle this could be written as (untested):
"""
#------------------------------------------------------------------------
import StringIO
import uu
def uu2string(data, mode=None):
outfile = StringIO.StringIO()
infile = StringIO.StringIO(data)
uu.decode(infile, outfile, mode)
return outfile.getvalue()
#------------------------------------------------------------------------