摘要:这是一个很普通的问题,网上已经很多人在讨论了,因为最近想使用Python来做一些化学方面的工作,主要是网上的资料收集,所以难免也需要使用该功能来爬一些内容。 1 #coding=utf-8 2 from sgmllib import SGMLParser 3 import urllib 4 5 class ListParser(SGMLParser): 6 #def __init__(self): 7 # self.lister=[] 8 9 def reset(self):10 self.lister=[]11 ...
阅读全文
摘要:维基百科上的介绍如下SDFFilename extension:.sd, .sdfInternet media type:chemical/x-mdl-sdfileType of format:chemical file formatSDF is one of a family of chemical-data file formats developed by MDL; it is intended especially for structural information. "SDF" stands for structure-data file, and SDF fi
阅读全文
摘要:结合上篇博文,下面我们写一小段测试代码,用于将标准的iupac name转化成化学结构这段代码使用到了ChemOffice中的ChemScript12模块。ChemScript12模块是一个商业模块,提供Python和.Net接口,在安装ChemOffice的时候选择安装ChemScript,同时安装Python25。 1 from ChemScript12 import * 2 3 name_file='./name.txt' 4 sdf_file='./sdf_file.sdf' 5 6 writer=SDFileWriter(sdf_file) 7 8 f
阅读全文
摘要:该类主要基于http://cactus.nci.nih.gov/chemical网站的,你可以利用已知的信息在该网站查询其他信息,比如你知道一个化合物的cas号,你可以在该网站查询到它的iupac name。该类中设置了超时时间为10秒,并简单的把一切不正常返回都提示为超时错误(如果需要,必须细致甄别不同类型的错误)。 1 # -*- coding: utf-8 -*- 2 import urllib2 3 import socket 4 5 #--------------------------------------------------------------------------.
阅读全文
摘要:本人Python初学者,准备用Python进行化学方面的工作,希望有所进步!
阅读全文