Sometimes I want to use multiple spaces in strings for cosmetic reasons. But Streamlit will always turn multiple spaces into a single space.
Why? Any ideas on how to disable / workaround?
Thanks ![]()
Sometimes I want to use multiple spaces in strings for cosmetic reasons. But Streamlit will always turn multiple spaces into a single space.
Why? Any ideas on how to disable / workaround?
Thanks ![]()
Streamlit is probably parsing your string as markdown. Is st.text() what you are looking for?
Ah ok that makes sense. But, I am trying to arrange things in an st.info box, but it is only seeing it as markdown, and going st.info(st.text("spaces ")) (unsurprisingly) doesn’t work.
Then you have to learn how to tell markdown to format the text as you want. For example using blocks of preformatted text.
s = """
Normal text m
```
preformatted text text after spaces
indented text
```
More normal text
"""
st.info(s)
Thanks for that @Goyo, amazing ![]()
Btw. in st.info you can use to add space. It works on our forum as well: " " = " "
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.