I want to print my output to the console (the one showing the log information or, better yet, a separate console) rather than an output cell in the iPython web notebook.
This is because I frequently have very long output I like to scroll through, and Chrome lags and breaks on large output, whereas iTerm2 does not.
Update of the answer from valhallasw:
You should use the following, otherwise it returns TypeError: a bytes-like object is required, not 'str'
.
import os
os.write(1, b"text\n")
Otherwise, you can also do as Oliver Evans said:
import os
os.write(1, "text\n".encode())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With