Performance effect of using print statements in Python script

Posted by Sudar on Stack Overflow See other posts from Stack Overflow or by Sudar
Published on 2012-11-08T11:28:26Z Indexed on 2012/11/09 5:01 UTC
Read the original article Hit count: 150

Filed under:
|
|

I have a Python script that process a huge text file (with around 4 millon lines) and writes the data into two separate files.

I have added a print statement, which outputs a string for every line for debugging. I want to know how bad it could be from the performance perspective?

If it is going to very bad, I can remove the debugging line.

Edit

It turns out that having a print statement for every line in a file with 4 million lines is increasing the time way too much.

© Stack Overflow or respective owner

Related posts about python

Related posts about console