Display a code block with optional syntax highlighting.
Function signature

st.code(body, language='python')

Parameters

body (str)

The string to display as code.

language (str)

The language that the code is written in, for syntax highlighting. If omitted, the code will be unstyled.

Was this page helpful?

forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.