Home > Mobile >  Is it possible to save a text after clicking a button on streamlit?
Is it possible to save a text after clicking a button on streamlit?

Time:09-13

I have

b0 = st.button("Hi There", key=0)
        if b0:
            st.write("gratitude word")

is it possible to save the output of clicking b0? so basically saving the "gratitude word" as CSV, named something like file_one.csv

CodePudding user response:

b0 = st.button("Hi There", key=0)
    if b0:
        st.write("gratitude word")
        with open("file.csv", "w") as f:
            print("xxx", file=f)

does the job.

  • Related