[Tutor] creating files with python and a thanks

Eve Kotyk e.kotyk@shaw.ca
Sun, 17 Feb 2002 03:59:05 +0000


 
> -----------------------
> this is my file
> my stuff
> is in
> my
> file
> ----------------------
> 
> and let's say you want to save in on your computer under the name
> 
> myfile.mbg
> 
> Then this code should work:
> 
> f = open('myfile.mbg', 'w')
> f.write('this is my file\nmy stuff\nis in\nmy\nfile')
> f.close()
> 
This is interesting to me for my project.  So if instead of f.write
('this is my file...., ..) I wanted to write the whole input and output
of a function to a file how would I do that?
-- 

ekotyk

http://members.shaw.ca/e.kotyk/virtualstudio.htm