-1

In a Flask application, I utilize the subprocess module to run a command in a shell on a Linux-based device. I send the command's output as a field in the HTTP response, and the browser displays it in an HTML template that I've written. When I display the output, it looks weirdly spaced and just has an odd format in general. How can I preserve the spacing/format of the output when displaying it using an HTML file? Is it possible to do this in a way where the output that is displayed looks visually pleasing, with a professional-looking style/font?

  • Did you try using
    {shell output}
    ? This should keep newline and spacing. It might be helpful if you add some code of your HTML template so that users can see what you tried so far.
    – Michael Lihs Jul 16 '18 at 22:43

1 Answers1

1

Wrap your output in preformatted tags, i.e.

<pre>
shell output
goes here
</pre>

shell output
goes here

That tells the browser to use fixed pitch font and not to rewrap it.