Python 导入数学和类型错误:';内置函数或方法';对象不可下标 回溯(最近一次呼叫最后一次): 文件“C:\Users\13609\Documents\Search\dg.py”,第14行,在 获取距离(48,50,87,22) 文件“C:\Users\13609\Documents\Search\dg.py”,第10行,在get\U距离内 角距离=m.cos[m.sin(latx)*m.sin(latp)+m.cos(latx)*m.cos(latp)*m.cos(lonp lonx)] TypeError:“内置函数”或“方法”对象不可下标

Python 导入数学和类型错误:';内置函数或方法';对象不可下标 回溯(最近一次呼叫最后一次): 文件“C:\Users\13609\Documents\Search\dg.py”,第14行,在 获取距离(48,50,87,22) 文件“C:\Users\13609\Documents\Search\dg.py”,第10行,在get\U距离内 角距离=m.cos[m.sin(latx)*m.sin(latp)+m.cos(latx)*m.cos(latp)*m.cos(lonp lonx)] TypeError:“内置函数”或“方法”对象不可下标,python,math,Python,Math,调用m.cos时需要使用括号。 方法调用应如下所示: Traceback (most recent call last): File "C:\Users\13609\Documents\Search\dg.py", line 14, in <module> get_distance(48,50,87,22) File "C:\Users\13609\Documents\Search\dg.py", line 10, in get_distance angula

调用m.cos时需要使用括号。 方法调用应如下所示:

Traceback (most recent call last):
  File "C:\Users\13609\Documents\Search\dg.py", line 14, in <module>
    get_distance(48,50,87,22)
  File "C:\Users\13609\Documents\Search\dg.py", line 10, in get_distance
    angular_distance = m.cos[m.sin(latx)*m.sin(latp)+m.cos(latx)*m.cos(latp)*m.cos(lonp-lonx)]
TypeError: 'builtin_function_or_method' object is not subscriptable


调用m.cos时需要使用括号。 方法调用应如下所示:

Traceback (most recent call last):
  File "C:\Users\13609\Documents\Search\dg.py", line 14, in <module>
    get_distance(48,50,87,22)
  File "C:\Users\13609\Documents\Search\dg.py", line 10, in get_distance
    angular_distance = m.cos[m.sin(latx)*m.sin(latp)+m.cos(latx)*m.cos(latp)*m.cos(lonp-lonx)]
TypeError: 'builtin_function_or_method' object is not subscriptable

m.cos
是一个函数,您想调用它(
()
)而不是索引到它(
[]
)。
m.cos
是一个函数,您想调用它(
()
)而不是索引到它(
[]
)。
m.cos(m.sin(latx)*m.sin(latp)+m.cos(latx)*m.cos(latp)*m.cos(lonp-lonx))