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?










2















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.










share|improve this question




























    2















    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.










    share|improve this question


























      2












      2








      2








      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.










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 6:25







      Mike

















      asked Mar 7 at 2:57









      MikeMike

      205




      205






















          2 Answers
          2






          active

          oldest

          votes


















          2














          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.)






          share|improve 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


















          1














          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






          share|improve this answer























          • 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











          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
          );



          );













          draft saved

          draft discarded


















          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









          2














          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.)






          share|improve 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















          2














          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.)






          share|improve 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













          2












          2








          2







          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.)






          share|improve 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.)







          share|improve this answer














          share|improve this answer



          share|improve 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












          • 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













          1














          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






          share|improve this answer























          • 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
















          1














          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






          share|improve this answer























          • 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














          1












          1








          1







          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






          share|improve this answer













          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







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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


















          • 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


















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived