def export(ip,channel_search_list):
if len(ip) > 0:
filename = "files//"+"output"+str(ip)+".txt"
action = 'FullExport'
menu_action = 'all'
arg_list = '/home/venv/upnp/bin/python2.7 /home/code/upnp/Client/UPNP_Client_Cmd_Line.py'
arg_list += ' --action='
arg_list += action
arg_list += ' --ip='
arg_list += (str(ip))
arg_list += ' --menu='
arg_list += menu_action
x = subprocess.Popen(arg_list, shell=True)
with open(filename, "w+") as output:
subprocess.call(['python', arg_list], stdout=output, stderr=subprocess.PIPE)
get_book_ids_func(filename, channel_search_list, ip)
我正在尝试使用子进程将一些数据导出到txt文件。但是,通过上述功能,它可以直接在命令屏幕上输出数据。它不会导出到txt文件中。任何建议将不胜感激。