我想telnet到我的路由器,我想自动化它,所以我不必一直登录,因为我一天做几次.
除了VBS中的sendkeys之外还有其他方法吗?这是因为物理类型,所以telnet窗口需要是活动的,而且相当烦人.
我尝试了一个批处理文件,但结果却非常奇怪.这里是:
telnet 192.168.1.254
REM This is the router IP
ping 255.255.255.255 -n 1 -w 1000 > nul
REM This is to wait for the router if its being slow
George
REM This is the username, as it prompts as soon as it logs in
ping 255.255.255.255 -n 1 -w 1000 > nul
(the password)
ping 255.255.255.255 -n 1 -w 1000 > nul
system
REM Enters the system menu
ping 255.255.255.255 -n 1 -w 10 > nul
debug
REM …Run Code Online (Sandbox Code Playgroud) 我正在使用codecademy学习Javascript,并且进行了一些比较,而对于我的代码,我做了:
`console.log(1 == 2)`
Run Code Online (Sandbox Code Playgroud)
它又回来了False。我也做了:
`console.log(2*2 === 3)`
Run Code Online (Sandbox Code Playgroud)
那也回来了False。为了检查我没有记错,我做了:
`console.log(1 == 1)`
Run Code Online (Sandbox Code Playgroud)
然后返回True
说明指示告诉我===等于。
使用==代替有什么问题===吗?而且,哪个更好用?为什么?
感谢你给与我的帮助!
我正在玩 Python 2.7,每个人都知道在每个程序开始时,您总是必须导入模块。例如:
import random
import time
for x in range(1, 300):
print random.randint(1,100)
time.sleep(1)
print "Done!"
Run Code Online (Sandbox Code Playgroud)
无论如何,我在想,为什么我必须手动导入所有模块?为什么 Python 不只是像这样导入它们。
当然,我可以理解为什么它不会像这样导入:
from random import randint
from time import *
for x in range(1, 300):
print randint(1,100)
sleep(1)
print "Done!"
Run Code Online (Sandbox Code Playgroud)
由于某些函数名称可能会发生冲突。但是,如果您必须定义函数在开始时的位置,例如random.在random.randint(1,100).
现在现代计算机如此强大,自动导入每个模块似乎是合乎逻辑的,而不是浪费代码行和时间,因为必须找到您需要的模块,然后在可以轻松自动化时手动导入它。那么,为什么python不会在启动时自动导入每个模块呢?
编辑:我制作了一个小程序的新版本,它导入了我可以通过运行找到的每个模块:
import sys
sys.builtin_module_names
Run Code Online (Sandbox Code Playgroud)
结果如下:
x = int(1000000)
def test():
global x
x -= 1
print "Iterations Left: ", x
import __builtin__
import __main__
import _ast
import _bisect
import _codecs
import _codecs_cn
import _codecs_hk
import …Run Code Online (Sandbox Code Playgroud) batch-file ×1
boolean ×1
comparison ×1
console.log ×1
equals ×1
javascript ×1
module ×1
python ×1
python-2.7 ×1
scripting ×1
telnet ×1
windows ×1