【发布时间】:2019-03-13 01:05:30
【问题描述】:
这是我的代码
#!usr/bin/python
from __future__ import print_function
import sqlite3
import os, sys, subprocess
import numpy as np
from Bio import Entrez
from Bio import Medline
Entrez.email = "shayezkarimcide@gmail.com"
handle = Entrez.esearch(db="pmc",
term = "Antimicrobial resistance",
rettype = "medline",retmode = "txt",
retmax= '10',sort = "pub date")
result = Entrez.read(handle)
handle.close()
Id = result ['IdList']
print (list(Id), "\n")
rint ("The length of PubId is :",len(Id))
conn = sqlite3.connect('/home/cbbi-l2-16/Desktop/karim')
c = conn.cursor()
print ("Opened database successfully")
c.executemany("INSERT INTO Entrez (PuId) VALUES (?)", Id)
for row in c :
print (row)
conn.commit()
print ("Records Save Successfully")
conn.close()?
它给出错误
文件“sqlpython.py”,第 42 行,在 c.executemany(“插入Entrez(PuId)值(?)”,Id) sqlite3.ProgrammingError:提供的绑定数量不正确。当前语句使用 1,提供了 7 个。
【问题讨论】:
-
请展示您通过
print(result ['IdList'])获得的收益 -
你猜想
c.executemany("INSERT INTO Entrez (PuId) VALUES (?)", [[x] for x in Id]) -
print (result['IdList']) 它不会给研究文章一堆