python - Strange Google Colab ping result
问题描述
When I try to use ping in colab I get:
!ping binance.com
/bin/bash: ping: command not found
The quick reference guide is not showing ping:
%quickref
But using os library seems to execute the ping command:
import os
os.system("ping binance.com")
32512
What is the meaning of the result? (32512)
解决方案
我认为目前,除非您为 pro 付费,否则在 google colab 中没有其他使用终端的方法。ping 中的 32512 表示密钥已过期。
import os
hostname = "binance.com"
response = os.system("ping -c 1 " + hostname)
if response == 0:
print(hostname, 'Connected')
else:
print(hostname, 'Connect Fail')
你可以试试这个代码,应该会给你一个更清晰的结果,即“连接失败”过去,你可以使用 Teleconsole,但它自 2021 年 9 月 4 日起被关闭
推荐阅读
- android - API 26 的 RecyclerView - 安卓
- javascript - 如何将行 ID 传递到功能 onclick 按钮、引导表
- laravel - production.ERROR:调用数组 {"userId":1,"exception":"[object] 上的成员函数 all()
- android - 在 android studio 4.0 上没有检测到可调试的进程
- json - 如何在 JSON 文件中使用变量作为前缀
- assembly - 在 RISCV 内存中加载 32 位立即数
- python - Python 的 json.dump() 不会导致开始 '[' 括号和结束 ']' 括号
- scheme - 如何在 Guile 中更改引用值的内容
- python - 用于读取特定 .csv 语法的 RegEx 表达式
- c# - IE 打开新选项卡 about:blank 而不是网页