import ephem
from ephem import *
## Planet name plus () and return
## just to show what the name must be
buscar = 'Jupiter()' + '\n'
aqui = city('Bogota')
aqui.date = now() - 5/24 ## Substract the time zone hours from UTC
if buscar[-3:-1] == '()': ## Delete unwanted chars
astro = buscar[:-3]
cuerpo = getattr(ephem, astro)() ## YOUR ANSWER
## Body test
cuerpo.compute(aqui)
print(aqui.name, aqui.date)
print(cuerpo.name, cuerpo.az, cuerpo.alt)
您可以找到教程here。在
例如:
我想你可以在那里找到更多的细节。在
一个有趣的问题!确实存在底层
_libastro
用来告诉ephem
本身支持哪些对象的内部方法:哪个打印:
^{pr2}$您只需要这三项中的最后一项,因此可以构建一个名称列表,例如:
返回:
然后,您可以通过一个简单的
name
调用来获取这些对象中的任何一个。在相关问题 更多 >
编程相关推荐