How to get the name of an element in PubChemPy?

506 Views Asked by At

Can you please tell me if it is possible to get the name of an element in PubChemPy? I found in the documentation that can find the PubChem CID by name:

result = pcp.get_compounds('Glucose', 'name')
print(result)

[Compound(5793)]

But I need the other way around, by CID to find the name of the element. Maybe someone knows how to do this?

1

There are 1 best solutions below

2
Seif Mahdy On

You can get the Compound with CID as follows:

c = pcp.Compound.from_cid(5090)

then you can get all the information you need from this object. for example:

>>> print c.iupac_name
3-(4-methylsulfonylphenyl)-4-phenyl-2H-furan-5-one

Check the docs for more info on the object attrs