Python Flask将我返回的名称大写

我在这里遇到了一个问题,现在我要从API返回一堆名称,并且要大写这些名称,或者每个空格后的首字母大写,每个空格都是一个下划线,并且我也希望替换此下划线与空间。

产品看起来像这样:BROWN_MUSHROOM

可以使用jquery或javascript完成。

HTML代码:

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="../static/style.css" />
    <script src="jquery-3.5.1.min.js"></script>
  </head>
  <body style="background-color: #333;">
    {% for product in products %}
    <b class="name" style="color: white;">Name: {{ product.id }}</b>
    <p style="color: white;">Sell Price: {{ product.sell_price }}</p>
    <p style="color: white;">
      Buy Price: {{ product.buy_price }}
    </p>
    {% endfor %}
  </body>

Python代码:

import requests
from flask import Flask, render_template
import datetime


product_names = [this array consists of every product name, removed it to keep the thread short!]

app = Flask(__name__)


@app.route('/')
def price():
    f = requests.get(
        "https://api.hypixel.net/skyblock/bazaar?key=[key shall be kept secret]").json()
    products = [
        {
            "id": product["product_id"],
            "sell_price": product["quick_status"]["sellPrice"],
            "buy_price": product["quick_status"]["buyPrice"]
        }
        for product in f["products"].values()
    ]
    return render_template("index.html", products=products)


if __name__ == "__main__":
    app.run(debug=True)