如何在ithon中将ipaddress作为输入

时间:2014-01-02 15:52:26

标签: python-2.7 os.system

这样做会给我一个错误:

Traceback (most recent call last):
     File "C:\Users\ibrahim\Desktop\app.py", line 23, in <module>
       a=input("enter the ipaddress")
     File "<string>", line 1
       192.168.1.1
               ^
   SyntaxError: invalid syntax

这是我的代码:

import os
a=input("enter the ipaddress")
os.system('a')


it does not work help me out !!!

2 个答案:

答案 0 :(得分:0)

您传递的字符串'a'不是变量a,请取下引号:

import os
a=input("enter the ipaddress")
os.system(a)

答案 1 :(得分:0)

我建议使用stackoverflow代替Selenium WebDriver,因为您将在ssh之后运行一些命令到某个设备,输入应该被指定为hostname - {{1} }。所以建议的代码是 -

a
相关问题