[Tutor] creating files with python and a thanks
Sat, 16 Feb 2002 20:35:03 -0800
On Sat, 16 Feb 2002 20:26:59 -0800, Sheila King <firstname.lastname@example.org>
wrote about Re: [Tutor] creating files with python and a thanks:
> If the function returns a string, then one possibility is:
OH, I forgot to include the case, for where the function returns
something that isn't a string...like it returns an integer, float, list,
dictionary, or what-have-you.
How about this?
f = open('myfile.txt', 'w')
f.write(str(function(param1, param2, ...)))
around anything will convert it to it's "string" representation, if that
is possible. For most of the basic types, I can't imagine a problem.
"When introducing your puppy to an adult cat,
restrain the puppy, not the cat." -- Gwen Bailey,
_The Perfect Puppy: How to Raise a Well-behaved Dog_