Guest User

Untitled

a guest
May 22nd, 2021
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. @app.route("/bd")
  2. def my_db():
  3.  
  4. l = []
  5.  
  6. with sq.connect("dota.bd") as con:
  7.  
  8. cur = con.cursor()
  9. cur.execute("""CREATE TABLE IF NOT EXISTS users (user_id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT NOT NULL)""")
  10.  
  11.  
  12. for row in cur.execute("SELECT name FROM users;"):
  13.  
  14. l.append(*row)
  15.  
  16. link = ""
  17.  
  18. for x in my_db():
  19.  
  20. link += f"<a href='/{x}'>{x}</a><br>"
  21.  
  22. return l
Advertisement
Add Comment
Please, Sign In to add comment