Error while displaying output - Python - SQLite2019 Community Moderator ElectionPython Sqlite3: INSERT INTO table VALUE(dictionary goes here)How to list the tables in a SQLite database file that was opened with ATTACH?Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Improve INSERT-per-second performance of SQLite?Does Python have a string 'contains' substring method?Way to create multiline comments in Python?
How does Ehrenfest's theorem apply to the quantum harmonic oscillator?
What materials can be used to make a humanoid skin warm?
Why do we say ‘pairwise disjoint’, rather than ‘disjoint’?
What is this diamond of every day?
Are there historical instances of the capital of a colonising country being temporarily or permanently shifted to one of its colonies?
Can I negotiate a patent idea for a raise, under French law?
Why is a very small peak with larger m/z not considered to be the molecular ion?
Source permutation
What is Tony Stark injecting into himself in Iron Man 3?
Do cubics always have one real root?
Is it safe to abruptly remove Arduino power?
Is it possible to avoid unpacking when merging Association?
Should I take out a loan for a friend to invest on my behalf?
Specifying a starting column with colortbl package and xcolor
How to resolve: Reviewer #1 says remove section X vs. Reviewer #2 says expand section X
Outlet with 3 sets of wires
Plausibility of Mushroom Buildings
Dynamic Linkage of LocatorPane and InputField
How do electrons receive energy when a body is heated?
Street obstacles in New Zealand
Which situations would cause a company to ground or recall a aircraft series?
Making a kiddush for a girl that has hard time finding shidduch
Is it a Cyclops number? "Nobody" knows!
Why is there an extra space when I type "ls" in the Desktop directory?
Error while displaying output - Python - SQLite
2019 Community Moderator ElectionPython Sqlite3: INSERT INTO table VALUE(dictionary goes here)How to list the tables in a SQLite database file that was opened with ATTACH?Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Improve INSERT-per-second performance of SQLite?Does Python have a string 'contains' substring method?Way to create multiline comments in Python?
I have a set of data in a list, embedded into a dictionary as:
'list1': ['Freddy','36','fred','123f','2017/04/25'],
'list2':['Tara','25','mtara','123t','2018/03/22']
Ref notations:
key1: [name, age,nickname, userid, account_created_date],
..key2:[name, age,nickname, userid, account_created_date]
All the data is inserted in variables in a Python function, one for each, as described above. When I call the function I would get the output right-away as
Output:
Freddy
Tara
But when I try to insert the data into a sqlite database, I get the output in the following manner:
Output:
F
R
E
D
D
Y
T
A
R
A
Code:conn = sqlite3.connect(dbPath)
cur = conn.cursor()
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
conn.commit()
Requesting your assistance on this issue. Your help is much appreciated. Thank You.
python python-3.x python-2.7 sqlite sqlite3
add a comment |
I have a set of data in a list, embedded into a dictionary as:
'list1': ['Freddy','36','fred','123f','2017/04/25'],
'list2':['Tara','25','mtara','123t','2018/03/22']
Ref notations:
key1: [name, age,nickname, userid, account_created_date],
..key2:[name, age,nickname, userid, account_created_date]
All the data is inserted in variables in a Python function, one for each, as described above. When I call the function I would get the output right-away as
Output:
Freddy
Tara
But when I try to insert the data into a sqlite database, I get the output in the following manner:
Output:
F
R
E
D
D
Y
T
A
R
A
Code:conn = sqlite3.connect(dbPath)
cur = conn.cursor()
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
conn.commit()
Requesting your assistance on this issue. Your help is much appreciated. Thank You.
python python-3.x python-2.7 sqlite sqlite3
add a comment |
I have a set of data in a list, embedded into a dictionary as:
'list1': ['Freddy','36','fred','123f','2017/04/25'],
'list2':['Tara','25','mtara','123t','2018/03/22']
Ref notations:
key1: [name, age,nickname, userid, account_created_date],
..key2:[name, age,nickname, userid, account_created_date]
All the data is inserted in variables in a Python function, one for each, as described above. When I call the function I would get the output right-away as
Output:
Freddy
Tara
But when I try to insert the data into a sqlite database, I get the output in the following manner:
Output:
F
R
E
D
D
Y
T
A
R
A
Code:conn = sqlite3.connect(dbPath)
cur = conn.cursor()
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
conn.commit()
Requesting your assistance on this issue. Your help is much appreciated. Thank You.
python python-3.x python-2.7 sqlite sqlite3
I have a set of data in a list, embedded into a dictionary as:
'list1': ['Freddy','36','fred','123f','2017/04/25'],
'list2':['Tara','25','mtara','123t','2018/03/22']
Ref notations:
key1: [name, age,nickname, userid, account_created_date],
..key2:[name, age,nickname, userid, account_created_date]
All the data is inserted in variables in a Python function, one for each, as described above. When I call the function I would get the output right-away as
Output:
Freddy
Tara
But when I try to insert the data into a sqlite database, I get the output in the following manner:
Output:
F
R
E
D
D
Y
T
A
R
A
Code:conn = sqlite3.connect(dbPath)
cur = conn.cursor()
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
conn.commit()
Requesting your assistance on this issue. Your help is much appreciated. Thank You.
python python-3.x python-2.7 sqlite sqlite3
python python-3.x python-2.7 sqlite sqlite3
edited Mar 7 at 6:25
Mike
asked Mar 7 at 2:57
MikeMike
205
205
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
New Answer
To suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
The rest of the SQLite3 code working, this outputs:
Freddy
Joan
Option to Use a List of Tuples
You can also use a list of tuples. If you're not using a dictionary, you need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Output:
Freddy
Joan
So make sure each entry is in tuple or dictionary form. Then put these tuples or dictionaries into a list. If it's in dictionary form, you cannot use the '?' placeholder. Use ':key_name' for each placeholder. (There might be a different option here, but I haven't found it yet).
Original Response
I suspect that executemany(...) should be execute(...). I haven't used SQLite3 in a while, so I'll test it now to make sure and then get back to you.
Update 1:
I remember the "?'s" needing to be sent in tuple form. I.e.
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
needs to be at least
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name, ...))
But I've only gotten the execute() (and not executemany()) to work, with this, else it's back to the same error. So, here's my working code so far:
cur.execute("INSERT INTO Field (Field1) VALUES (?)", (name,))
It gave F, R, E, D, D, Y because it was reading each letter as values in the tuple. If it was in tuple form, it would read "Freddy" all in one go. But I'm still having issues with the executemany(), which I think works differently than we think it does.
Update 2:
Here's what I got to work. You need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Full code:
import sqlite3
conn = sqlite3.connect('test.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE IF NOT EXISTS names
(name text)''')
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
conn.commit()
for row in c.execute('SELECT * FROM names'):
print(row[0])
This prints out:
Freddy
Joan
Update 3:
I've updated it to suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
Here's some more code, I've gotten to work.
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
With the rest of the code as it was, it outputs:
Freddy
Joan
(Inspired from this answer.)
1
Thanks Aaron, Your idea worked. I had the whole data into lists and there-after had them converted as tuples. Apart from that, I also had to change the sqlite function from executemany to execute and have that in a for loop.
– Mike
Mar 7 at 7:46
add a comment |
you might consider to change
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
to
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name))
since the expected parameter is a tuple, the string is not considered as a whole but splited
Hi, Thank You for your response. I did so, but there's no difference in output. I get the same thing.
– Mike
Mar 7 at 6:36
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55035355%2ferror-while-displaying-output-python-sqlite%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
New Answer
To suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
The rest of the SQLite3 code working, this outputs:
Freddy
Joan
Option to Use a List of Tuples
You can also use a list of tuples. If you're not using a dictionary, you need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Output:
Freddy
Joan
So make sure each entry is in tuple or dictionary form. Then put these tuples or dictionaries into a list. If it's in dictionary form, you cannot use the '?' placeholder. Use ':key_name' for each placeholder. (There might be a different option here, but I haven't found it yet).
Original Response
I suspect that executemany(...) should be execute(...). I haven't used SQLite3 in a while, so I'll test it now to make sure and then get back to you.
Update 1:
I remember the "?'s" needing to be sent in tuple form. I.e.
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
needs to be at least
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name, ...))
But I've only gotten the execute() (and not executemany()) to work, with this, else it's back to the same error. So, here's my working code so far:
cur.execute("INSERT INTO Field (Field1) VALUES (?)", (name,))
It gave F, R, E, D, D, Y because it was reading each letter as values in the tuple. If it was in tuple form, it would read "Freddy" all in one go. But I'm still having issues with the executemany(), which I think works differently than we think it does.
Update 2:
Here's what I got to work. You need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Full code:
import sqlite3
conn = sqlite3.connect('test.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE IF NOT EXISTS names
(name text)''')
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
conn.commit()
for row in c.execute('SELECT * FROM names'):
print(row[0])
This prints out:
Freddy
Joan
Update 3:
I've updated it to suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
Here's some more code, I've gotten to work.
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
With the rest of the code as it was, it outputs:
Freddy
Joan
(Inspired from this answer.)
1
Thanks Aaron, Your idea worked. I had the whole data into lists and there-after had them converted as tuples. Apart from that, I also had to change the sqlite function from executemany to execute and have that in a for loop.
– Mike
Mar 7 at 7:46
add a comment |
New Answer
To suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
The rest of the SQLite3 code working, this outputs:
Freddy
Joan
Option to Use a List of Tuples
You can also use a list of tuples. If you're not using a dictionary, you need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Output:
Freddy
Joan
So make sure each entry is in tuple or dictionary form. Then put these tuples or dictionaries into a list. If it's in dictionary form, you cannot use the '?' placeholder. Use ':key_name' for each placeholder. (There might be a different option here, but I haven't found it yet).
Original Response
I suspect that executemany(...) should be execute(...). I haven't used SQLite3 in a while, so I'll test it now to make sure and then get back to you.
Update 1:
I remember the "?'s" needing to be sent in tuple form. I.e.
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
needs to be at least
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name, ...))
But I've only gotten the execute() (and not executemany()) to work, with this, else it's back to the same error. So, here's my working code so far:
cur.execute("INSERT INTO Field (Field1) VALUES (?)", (name,))
It gave F, R, E, D, D, Y because it was reading each letter as values in the tuple. If it was in tuple form, it would read "Freddy" all in one go. But I'm still having issues with the executemany(), which I think works differently than we think it does.
Update 2:
Here's what I got to work. You need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Full code:
import sqlite3
conn = sqlite3.connect('test.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE IF NOT EXISTS names
(name text)''')
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
conn.commit()
for row in c.execute('SELECT * FROM names'):
print(row[0])
This prints out:
Freddy
Joan
Update 3:
I've updated it to suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
Here's some more code, I've gotten to work.
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
With the rest of the code as it was, it outputs:
Freddy
Joan
(Inspired from this answer.)
1
Thanks Aaron, Your idea worked. I had the whole data into lists and there-after had them converted as tuples. Apart from that, I also had to change the sqlite function from executemany to execute and have that in a for loop.
– Mike
Mar 7 at 7:46
add a comment |
New Answer
To suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
The rest of the SQLite3 code working, this outputs:
Freddy
Joan
Option to Use a List of Tuples
You can also use a list of tuples. If you're not using a dictionary, you need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Output:
Freddy
Joan
So make sure each entry is in tuple or dictionary form. Then put these tuples or dictionaries into a list. If it's in dictionary form, you cannot use the '?' placeholder. Use ':key_name' for each placeholder. (There might be a different option here, but I haven't found it yet).
Original Response
I suspect that executemany(...) should be execute(...). I haven't used SQLite3 in a while, so I'll test it now to make sure and then get back to you.
Update 1:
I remember the "?'s" needing to be sent in tuple form. I.e.
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
needs to be at least
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name, ...))
But I've only gotten the execute() (and not executemany()) to work, with this, else it's back to the same error. So, here's my working code so far:
cur.execute("INSERT INTO Field (Field1) VALUES (?)", (name,))
It gave F, R, E, D, D, Y because it was reading each letter as values in the tuple. If it was in tuple form, it would read "Freddy" all in one go. But I'm still having issues with the executemany(), which I think works differently than we think it does.
Update 2:
Here's what I got to work. You need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Full code:
import sqlite3
conn = sqlite3.connect('test.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE IF NOT EXISTS names
(name text)''')
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
conn.commit()
for row in c.execute('SELECT * FROM names'):
print(row[0])
This prints out:
Freddy
Joan
Update 3:
I've updated it to suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
Here's some more code, I've gotten to work.
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
With the rest of the code as it was, it outputs:
Freddy
Joan
(Inspired from this answer.)
New Answer
To suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
The rest of the SQLite3 code working, this outputs:
Freddy
Joan
Option to Use a List of Tuples
You can also use a list of tuples. If you're not using a dictionary, you need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Output:
Freddy
Joan
So make sure each entry is in tuple or dictionary form. Then put these tuples or dictionaries into a list. If it's in dictionary form, you cannot use the '?' placeholder. Use ':key_name' for each placeholder. (There might be a different option here, but I haven't found it yet).
Original Response
I suspect that executemany(...) should be execute(...). I haven't used SQLite3 in a while, so I'll test it now to make sure and then get back to you.
Update 1:
I remember the "?'s" needing to be sent in tuple form. I.e.
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
needs to be at least
cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name, ...))
But I've only gotten the execute() (and not executemany()) to work, with this, else it's back to the same error. So, here's my working code so far:
cur.execute("INSERT INTO Field (Field1) VALUES (?)", (name,))
It gave F, R, E, D, D, Y because it was reading each letter as values in the tuple. If it was in tuple form, it would read "Freddy" all in one go. But I'm still having issues with the executemany(), which I think works differently than we think it does.
Update 2:
Here's what I got to work. You need to make sure each row is in tuple form. You need each of these tuples in a list. You need to call this list in the executemany function after the SQL query.
Essential code:
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
Full code:
import sqlite3
conn = sqlite3.connect('test.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE IF NOT EXISTS names
(name text)''')
names = [("Freddy",), ("Joan",)]
results = c.executemany("INSERT INTO names (name) VALUES (?)", names)
conn.commit()
for row in c.execute('SELECT * FROM names'):
print(row[0])
This prints out:
Freddy
Joan
Update 3:
I've updated it to suit your dataset more directly. You need a list of dictionaries, not a dictionary of lists because each dictionary has the column name as the key and a value associated with that column (key).
Here's some more code, I've gotten to work.
names = ['name': "Freddy", 'name': "Joan"]
results = c.executemany("INSERT INTO names ('name') VALUES (:name)", names)
With the rest of the code as it was, it outputs:
Freddy
Joan
(Inspired from this answer.)
edited Mar 7 at 7:23
answered Mar 7 at 6:30
Aaron BellAaron Bell
715
715
1
Thanks Aaron, Your idea worked. I had the whole data into lists and there-after had them converted as tuples. Apart from that, I also had to change the sqlite function from executemany to execute and have that in a for loop.
– Mike
Mar 7 at 7:46
add a comment |
1
Thanks Aaron, Your idea worked. I had the whole data into lists and there-after had them converted as tuples. Apart from that, I also had to change the sqlite function from executemany to execute and have that in a for loop.
– Mike
Mar 7 at 7:46
1
1
Thanks Aaron, Your idea worked. I had the whole data into lists and there-after had them converted as tuples. Apart from that, I also had to change the sqlite function from executemany to execute and have that in a for loop.
– Mike
Mar 7 at 7:46
Thanks Aaron, Your idea worked. I had the whole data into lists and there-after had them converted as tuples. Apart from that, I also had to change the sqlite function from executemany to execute and have that in a for loop.
– Mike
Mar 7 at 7:46
add a comment |
you might consider to change
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
to
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name))
since the expected parameter is a tuple, the string is not considered as a whole but splited
Hi, Thank You for your response. I did so, but there's no difference in output. I get the same thing.
– Mike
Mar 7 at 6:36
add a comment |
you might consider to change
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
to
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name))
since the expected parameter is a tuple, the string is not considered as a whole but splited
Hi, Thank You for your response. I did so, but there's no difference in output. I get the same thing.
– Mike
Mar 7 at 6:36
add a comment |
you might consider to change
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
to
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name))
since the expected parameter is a tuple, the string is not considered as a whole but splited
you might consider to change
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", name)
to
results = cur.executemany("INSERT INTO Field (Field1) VALUES (?)", (name))
since the expected parameter is a tuple, the string is not considered as a whole but splited
answered Mar 7 at 6:34
Jack WuJack Wu
19610
19610
Hi, Thank You for your response. I did so, but there's no difference in output. I get the same thing.
– Mike
Mar 7 at 6:36
add a comment |
Hi, Thank You for your response. I did so, but there's no difference in output. I get the same thing.
– Mike
Mar 7 at 6:36
Hi, Thank You for your response. I did so, but there's no difference in output. I get the same thing.
– Mike
Mar 7 at 6:36
Hi, Thank You for your response. I did so, but there's no difference in output. I get the same thing.
– Mike
Mar 7 at 6:36
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55035355%2ferror-while-displaying-output-python-sqlite%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown