如何将字符串格式化为HTML中的代码

发布于 2025-02-08 04:15:32 字数 494 浏览 0 评论 0原文

我有此代码作为对象的一部分返回,并将其存储为类型字符串。这就是它存储的方式:

def helloWorld():    print("hello World")helloWorld()

如您所见,它全部都在一行上的一个字符串中。

在html中,我像这样访问它:

<textarea type="text" class="form-control" name="output" id="exampleInputPassword1" style="height: 300px;" readonly><%= recordData.output %></textarea>

现在,我希望能够格式化&lt;%= recorddata.output%&gt;作为代码,以使其不在一行中。这是否可以通过HTMLJS进行?

I have this code which is returned as a part of an object, and is stored as type string. this is the way it is stored:

def helloWorld():    print("hello World")helloWorld()

as you can see, it is all in one string on one line.

In html, i am accessing this like so:

<textarea type="text" class="form-control" name="output" id="exampleInputPassword1" style="height: 300px;" readonly><%= recordData.output %></textarea>

now, I want to be able to format <%= recordData.output %> as code so that it isn't in one line. is this possible either through html or js?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文