我有这个密码:
from subprocess import call
domain = input('input domain\n>>')
callme = 'whois %s ' % domain
data = call(callme, shell=True)
当我试着
print('TYPE OF DATA\n>>%s' % type(data))
它还给了我
<class 'int'>
我需要操纵返回,但我不能解析这个对象。我试过str()和repr(),然后json.loads文件()但这些都不适合我
Tags:
您拥有流程的退出代码。参见^{} documentation :
对于链接的
returncode
条目:如果期望进程在stdout上生成输出,则应使用^{} ,并将
stdout
设置为subprocess.PIPE
,以便用Python读取该输出:这将为您提供一个
bytes
对象;您可以设置text=True
以获得解码的字符串值。你知道吗演示:
相关问题 更多 >
编程相关推荐