Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Dash: How to add a newline in string?

$
0
0

@caseguide wrote:

I would like to render some json with each bit between {} on its own line like so:
{“Question”:“WorkerId”,“Answer”:“123”}
{“Question”:“HITId”,“Answer”:“456”}
{“Question”:“Industry”,“Answer”:“789”}

I tried using Markdown’s two spaces as shown below as well as trying to string replace with <br>. Whats the correct way to accomplish adding new lines to a string in Dash?

newstring = '{"Question":"WorkerId","Answer":"123"} {"Question":"HITId","Answer":"456"} {"Question":"Industry","Answer":"789"} '  
newstring = newstring.replace("} {","}   {")
html.P("{}".format(newstring)),

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles