You are passing the string 'a' not the variable a
, take the quotation marks off:
import os
a=input("enter the ipaddress")
os.system(a)
سؤال
While doing this it gives me an error:
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
Here's my code:
import os
a=input("enter the ipaddress")
os.system('a')
it does not work help me out !!!
المحلول
You are passing the string 'a' not the variable a
, take the quotation marks off:
import os
a=input("enter the ipaddress")
os.system(a)
نصائح أخرى
I would suggest to use hostname
instead of a
, because as you will run some commands after ssh to some device, the input should get assigned as hostname
- ssh.connect(hostname, port=22, username=x, password=y)
. So the suggested code is -
import os
hostname=input("enter the ipaddress")
os.system(hostname)