OpenExoplanetCatalogue / open_exoplanet_catalogue

The main data repository for the Open Exoplanet Catalogue

Home Page:http://openexoplanetcatalogue.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors: How to access the catalogue using Python 3

JosephKarpinski opened this issue · comments

Current Python 3 examples have errors because print statements now require parentheses.
Please make the following corrections to the 'How to access the catalogue using Python' section:

Output mass and radius of all planets

for planet in oec.findall(".//planet"):
print([planet.findtext("mass"), planet.findtext("radius")])

Find all circumbinary planets

for planet in oec.findall(".//binary/planet"):
print(planet.findtext("name"))

Output distance to planetary system (in pc, if known) and number of planets in system

for system in oec.findall(".//system"):
print(system.findtext("distance"), len(system.findall(".//planet")))

Hi Joseph. Can you submit a pull request? Thanks!