import pubchempy as pcp
# list of chemical names
List_of_Chemicals = ['benzene', 'toluene', '2-nonenal']
for chemical_name in List_of_Chemicals:
cid=pcp.get_cids(chemical_name)
prop = pcp.get_properties('CanonicalSMILES', cid)
print (chemical_name + ' ' + str(prop))
The get_properties function allows the retrieval of specific properties without having to deal with entire compound records. This is especially useful for retrieving the properties of a large number of compounds at once:
p = pcp.get_properties('IsomericSMILES', 'CC', 'smiles', searchtype='superstructure')
第二次编辑:此代码从名称列表到获取cid,然后是属性:
get_属性需要cid作为必需参数。你不能输入化学名称。因此,您需要一个中间步骤来获取与pcp.get_cids中的名称对应的标识符列表,我在上面的代码中已经完成了这项工作
看起来您正在将列表传递到
get_properties()
,但它不接受列表,但可以接受几个不同的参数。以下是当前文档的摘录:https://pubchempy.readthedocs.io/en/latest/guide/properties.html
你的问题缺少很多有用的细节,但我想你实际上想要的是:
相关问题 更多 >
编程相关推荐