[英]replace single quotes with backticks
我需要用反引號將每個列表元素括起來 `` 以便可以將代碼發送到前端。 基本上,用反引號替換單引號 下面是我需要進行更改的列表。
['<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<link
href="https://www.moneycontrol.com/rss/latestnews.xml"
rel="alternate"
title="MoneyControl.com News"
type="application/rss+xml"
/>
</td>
</tr>
</table>',
'<table cellpadding="0" cellspacing="0" class="rhsglTbl" width="100%">
<thead>
<tr>
<th width="120">Index</th>
<th width="80">Price</th>
<th width="55">Change</th>
<th width="50">% Chg</th>
</tr>
</thead>
</table>']
需要進行此更改,以便我可以遍歷每個元素並將其添加到手風琴。
像這樣?
backticked = [ f"`{x}`" for x in your_list ]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.