问题描述
EJS 代码:
tags = soup.find_all("example")
for tag in tags:
tag.string = re.sub(r"[()]","",tag.string) # remove parentheses
egs = tag.string.split("; ") # or str(tag.contents).split("; ") ?
new = ""
if len(egs) > 1:
for eg in reversed(egs[1:]):
new = soup.new_tag("example")
new.string = eg
tag.insert_after(new)
tag.string = egs[0] # orig tag becomes 1st seg only
简单来说,这是来自服务器(节点后端)的学生数据。我希望用户将表格的第一列下载为 csv 文件。
我的 javascript 代码:
<table class="table-" id="attendance">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Roll number</th>
<th scope="col">Name</th>
<th scope="col">Class</th>
<th scope="col">Attendance</th>
<th scope="col">Percentage</th>
<th scope="col"> color</th>
</tr>
</thead>
<tbody>
<% studentArr.forEach((element,index) => { %>
<tr>
<th scope="row"><%= index + 1 %> </th>
<td> <%= element._id %> </td>
<td> <%= element.name %> </td>
<td> <%= element.class %> </td>
<td> <%= element.attendance %> </td>
<% let percentage = (element.attendance / 100) * 100 %>
<td> <%= percentage + "%" %> </td>
<% if (percentage >= 75) { %>
<td>
<input type="color" class="form-control form-control-color" id="exampleColorInput" value="#2cc946" disabled>
</td>
<% } else {%>
<td>
<input type="color" class="form-control form-control-color" id="exampleColorInput" value="#eb0505" disabled>
<% } %>
</tr>
<% }) %>
</tbody>
</table>
<div class="button">
<button type="button" class="btn btn-success" id="export"><i class="fas fa-download"></i>
Export to excel</button>
</div>
现在当我尝试下载它时出现网络失败错误。并且不知道我也没有完全理解 javascript 代码和错误。
我在上述问题上寻求帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)