简体   繁体   中英

Is there a way to print stdout as it is outputted?

If if I ran

from plumbum import local
local['ping']['google.com']()

It would just hang indefinitely because ping executes forever.

Is there a way to print the output of ping as it executes, perhaps in a generator or something, like

for a in local['ping']['google.com']():
    print a

According to the documentation , this should work:

from plumbum import local, FG

local["ping"]["google.com"] & FG

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM