0

I created a Python script that retrieves a list of payments that go to my companies email. I thought it would be interesting to do for Cashapp/Venmo payments to compile them. However I really want the site to format the payments/details so that each payment is on a new line. In the python I put final = final + ..... + \n for the string that is to be used in the html. Yet \n will not work in HTML no matter what I try to do.

In my views.py I set data=final, then call it here in the HTML.

<body>
    <button onclick="location.href='{% url 'script' %}'" >
        Check new payments
    </button> <hr>
    {% if data %}
    {{data}}
    {% endif %}
</body>

This prints out all the necessary data yet it is in one continuous string and does not include the \n. If I print it in the terminal it includes these. It is likely because html does not recognize \n I assume, I just don't know an alternative for this.

tripleee
  • 175,061
  • 34
  • 275
  • 318

0 Answers0