TypeError: 'float' object is not callable speedtest python

TypeError: 'float' object is not callable speedtest python

import speedtest

st = speedtest.Speedtest()

print('Loading server...')
st.get_servers()
print('Choosing best server...')
server = st.get_best_server()
print(f'Found: {server["host"]} located in {server["country"]} ')

print('Performing doonload...')
resDownload = st.download()
print('Perfotming upload...')
resUpload = st.upload()
resPing = st.results.ping()

print(f'''
      --- SPEED TEST COMPLETE ---
      Download speed [{resDownload / 1024 / 1024:.2f} Mbit/s]
      Upload speed   [{resUpload / 1024 / 1024:.2f} Mbit/s]
      Ping           [{resPing}] ms
      ''')



Traceback (most recent call last):
  File "C:\Users\CENSORED\Desktop\Wichtiges\python\Hacking\tools\speed.py", line 15, in <module>
    resPing = st.results.ping()
TypeError: 'float' object is not callable

我不知道该怎么办。 有人可以帮帮我吗我快疯了 xD 我必须写一些更多的细节,所以我的爱好是: 打鼓,编程,听黑金属。

我认为问题在于 ping 不是函数。尝试替换这个:

resPing = st.results.ping()

...有了这个:

resPing = st.results.ping