0

I want to create a lot of sql table? I think this, for exmaple:

import sqlite3
conn = sqlite3.connect(":memory:")
c = conn.cursor()
for x in range(0, 100):
    c.execute('''CREATE TABLE tableX (id real, name text,price real)''')

and X is in range: X: 0,1,.....,100

1
  • You can do it, but it looks like a wrong database design. If you start numbering your variables or tables you do something wrong. Commented Sep 25, 2014 at 12:26

1 Answer 1

1
import sqlite3
conn = sqlite3.connect(":memory:")
c = conn.cursor()
for x in range(0, 100):
    c.execute('''CREATE TABLE table%s (id real, name text,price real)'''%x)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.