Re: connect file object to standard output?

2006-05-08 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > I think there is a way to connect standard output to a > file, but I'd prefer not to do that, since I want to use plain print > statements to warn about errors in the function and have their output > appear on the screen. Thanks. > > def write_data(data,out_file="")

Re: connect file object to standard output?

2006-05-08 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I want to write a function that writes to an output file if specified > and otherwise to standard output. How can I connect a file object to > standard output in the code below? I could use an if statement to > choose between print and print>>fp throughout the function, b

Re: connect file object to standard output?

2006-05-08 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I want to write a function that writes to an output file if specified > and otherwise to standard output. How can I connect a file object to > standard output in the code below? I could use an if statement to > choose between print and print>>fp throughout the function,

connect file object to standard output?

2006-05-08 Thread beliavsky
I want to write a function that writes to an output file if specified and otherwise to standard output. How can I connect a file object to standard output in the code below? I could use an if statement to choose between print and print>>fp throughout the function, but this seems awkward. I think th