【发布时间】:2015-01-25 21:30:41
【问题描述】:
这是我要下载并保存的文件类型:
...这是测试代码:
import urllib.request
import xml.etree.ElementTree as ET
mystring = ' '
link = urllib.request.urlopen('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=protein&db=nuccore&linkname=protein_nuccore_mrna&id=13591999,149050462')
tree = ET.parse(link)
root = tree.getroot()
for branch in root.iter('Link'):
for something in branch.iter('Id'):
mystring += something.text + ','
mRNA = urllib.request.urlretrieve('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=' + mystring + '&rettype=fasta&retmode=text', 'C:/Users/User/Documents/mRNA.fasta')
它会创建文件但随后为空,我不知道问题出在哪里。谢谢你的帮助。
【问题讨论】:
标签: python url download urllib