Emm*_*wik 2 python flask python-3.x
从我的数据库中,我将返回一个列表以显示在我的HTML页面中,但我的列表中有这些不需要的符号.我尝试使用split()功能,但它不会工作.如何删除这些括号,逗号和引号.谢谢你的帮助
输出是:
[('cenomar',), ('cedula',), ('Birth Certificate',), ('Clearance',)]
Run Code Online (Sandbox Code Playgroud)
我想要:
[cenomar, cedula, Birth Certificate, Clearance]
Run Code Online (Sandbox Code Playgroud)
这是我的python函数:
@app.route('/')
def search():
conn=psycopg2.connect("dbname='forms' user='postgres' password='everboy'
host='localhost' port='5432'")
cur=conn.cursor()
cur.execute("SELECT name from form")
rows=cur.fetchall()
print(rows)
return render_template("form.html",rows=rows)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1332 次 |
| 最近记录: |