L
L
LinuxGod2020-08-29 10:23:16
Python
LinuxGod, 2020-08-29 10:23:16

Why doesn't print work in the console?

from nfstream import NFStreamer
import sys

path = sys.argv[1]
flow_streamer = NFStreamer(source=path)
result = {}

for flow in flow_streamer:
    print('-------------------------------------------------------------------------')
    print('FLOW')


output only when the program ends

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-08-29
@hottabxp

Most likely the code is working correctly. Try putting a delay in your code, and convince yourself that print() outputs data to the console on each iteration of the loop:

from nfstream import NFStreamer
import sys
import time

path = sys.argv[1]
flow_streamer = NFStreamer(source=path)
result = {}

for flow in flow_streamer:
    print('-------------------------------------------------------------------------')
    print('FLOW')
    time.sleep(0.2)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question