Write arguments to the app.
Function signature

st.write(*args, **kwargs)


*args (any)

One or many objects to print to the App.

Arguments are handled as follows:

  • write(string) : Prints the formatted Markdown string, with
    support for LaTeX expression and emoji shortcodes. See docs for st.markdown for more.
  • write(data_frame) : Displays the DataFrame as a table.
  • write(error) : Prints an exception specially.
  • write(func) : Displays information about a function.
  • write(module) : Displays information about the module.
  • write(dict) : Displays dict in an interactive widget.
  • write(mpl_fig) : Displays a Matplotlib figure.
  • write(altair) : Displays an Altair chart.
  • write(keras) : Displays a Keras model.
  • write(graphviz) : Displays a Graphviz graph.
  • write(plotly_fig) : Displays a Plotly figure.
  • write(bokeh_fig) : Displays a Bokeh figure.
  • write(sympy_expr) : Prints SymPy expression using LaTeX.
  • write(htmlable) : Prints _repr_html_() for the object if available.
  • write(obj) : Prints str(obj) if otherwise unknown.

unsafe_allow_html (bool)

This is a keyword-only argument that defaults to False.

By default, any HTML tags found in strings will be escaped and therefore treated as pure text. This behavior may be turned off by setting this argument to True.

That said, we strongly advise against it. It is hard to write secure HTML, so by using this argument you may be compromising your users' security. For more information, see:


Also note that `unsafe_allow_html` is a temporary measure and may be removed from Streamlit at any time.

If you decide to turn on HTML anyway, we ask you to please tell us your exact use case here: https://discuss.streamlit.io/t/96 .

This will help us come up with safe APIs that allow you to do what you want.

Was this page helpful?


Still have questions?

Our forums are full of helpful information and Streamlit experts.