How to get the name of an element in PubChemPy?

Viewed 55

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?

2 Answers

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

Related