How to render streamlit __in__ terminal?

I found out I can write scripts that render a streamlit web page, then use the same script with streamlit commands to do some script batch work, i.e. return value to the real script that then sends an alert or similar.

I would want still see the output of streamlit commands in the terminal. As a simple workaround, I did:

st.markdown = st.dataframe = st.write = st.header = st.subheader = (
    lambda v, **_: print(v)
)

And this works pretty well and redirects the outputs to the terminla seamlessly. However, there may be ready-to-use projects that render streamlit in the terminal. Is there already something known?

Hi @Kamilcuk

There’s a relevant thread that shows how to display terminal output in a Streamlit app:

You could also use the print() statement for displaying values from variables to the terminal.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.