if STREAM.isatty():
Chris Angelico
rosuav at gmail.com
Fri Aug 30 04:42:51 EDT 2019
On Fri, Aug 30, 2019 at 6:36 PM Hongyi Zhao <hongyi.zhao at gmail.com> wrote:
>
> On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote:
>
> > I don't understand what's to not to understand.
> >
> > if condition:
> > do_something_because_condition_is_true()
> > else:
> > do_something_because_condition_is_false()
> >
> > is a perfectly normal construction. If you mean something else, please
> > be explicit.
>
> I've read some more thing on the python 3 's print, seems for the isatty
> () discussed here is completely can done with using it by something like:
>
> print(p, end='\r', flush=True)
>
No, it can't. That will still do the same thing whether you're
outputting to a file or a console. The whole point of isatty() is to
log *differently* in those cases.
There is no magic here. It is simply asking a question, and then
making a decision based on the answer.
ChrisA
More information about the Python-list
mailing list