回复: Re: Need your help

2011-04-28 Thread 1011_wxy
Dear Thomas,JM,Chris Rebert: I got it. Thank you very very very much. Best Regards 2011-04-29 1011_wxy 发件人: Thomas Rachel 发送时间: 2011-04-28 21:26 主 题: Re: Need your help 收件人: python-list@python.org Am 28.04.2011 13:14, schrieb Chris Rebert: > import a, b, sys >

Re: Need your help

2011-04-28 Thread Thomas Rachel
Am 28.04.2011 13:14, schrieb Chris Rebert: import a, b, sys def c(): orig_stdout = sys.stdout sys.stdout = open('my_log_file.log', 'w') a.a() b.b() sys.stdout.close() sys.stdout = orig_stdout Someone may have written a with-statement context manager that abstracts

Re: 回复: Re: Need your help

2011-04-28 Thread Jean-Michel Pichavant
1011_wxy wrote: Hi JM: *python c.py > afile.log* could you pls give me the whole example? I am so sorry that I am a beginner in Python. Your module a and b that you cannot modify given your original description, are printing data using the print statement. That means these module only

回复: Re: Need your help

2011-04-28 Thread 1011_wxy
Hi JM: python c.py > afile.log could you pls give me the whole example? I am so sorry that I am a beginner in Python. 2011-04-28 1011_wxy 发件人: Jean-Michel Pichavant 发送时间: 2011-04-28 20:42 主 题: Re: Need your help 收件人: 1011_wxy <1011_...@163.com> 抄 送: "python-l

Re: Need your help

2011-04-28 Thread Jean-Michel Pichavant
1011_wxy wrote: Hi friends: Here I need some help. #encoding="utf-8" #moudle a.py def a(): print " function a!" #encoding="utf-8" #moudle b.py def b(): print " function b!" #encoding="utf-8" #moudle c.py import a import b def c(): a.a() b.b() Here in function c,How ca

Re: Need your help

2011-04-28 Thread Ervin Hegedüs
hello, On Thu, Apr 28, 2011 at 01:20:16PM +0200, Ervin Hegedüs wrote: > #!/usr/bin/python > > import a > import b > > import sys > import StringIO > > output = StringIO.StringIO() > > def c(): > # save default stdout > tout = sys.stdout > # redirect stdout to StringIO object >

Re: Need your help

2011-04-28 Thread Ervin Hegedüs
hello, > Here I need some help. > > #encoding="utf-8" > #moudle a.py > def a(): > print " function a!" > > #encoding="utf-8" > #moudle b.py > def b(): > print " function b!" > > > #encoding="utf-8" > #moudle c.py > import a > import b > def c(): > a.a() > b.b() > > > Here in func

Re: Need your help

2011-04-28 Thread Chris Rebert
On Wed, Apr 27, 2011 at 10:38 PM, 1011_wxy <1011_...@163.com> wrote: > Hi friends: > > Here I need some help. > > #encoding="utf-8" > #moudle a.py > def a(): >     print " function a!" > > #encoding="utf-8" > #moudle b.py > def b(): >     print " function b!" > > > #encoding="utf-8" > #moudle c.py