[英]How do I create a script that will take user input and use it in a terminal command using python 3.6?
I'm trying to write a script in python3.6 on linux that takes a user's input (in the form of a URL), then performs the 'whois' terminal command on the input provided. 我正在尝试在Linux上的python3.6中编写一个脚本,该脚本接受用户的输入(以URL的形式),然后在提供的输入上执行“ whois”终端命令。 I'm trying to launch it from IDLE. 我正在尝试从IDLE启动它。 The best I've got is: 我最好的是:
import os
os.system("clear")
os.system("gnome-terminal -e 'bash -c \'")
w = ""
w = (input("Who is your target?" ))
os.system("whois " + w)
It seems that after taking the input, the gnome terminal doesn't open, and nothing happens. 似乎在输入之后,gnome终端没有打开,什么也没有发生。 I'm not very experienced in python at the moment and I'm struggling quite a bit with this! 目前,我对python的了解还不是很丰富,为此我正苦苦挣扎!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.