我得到的重复数组如下: -
Array ( [0] => Afghanistan [1] => Albania ) Array ( [0] => Afghanistan [1] => Albania )
我如何删除这个重复的数组......我想要这样的输出..
Array ( [0] => Afghanistan [1] => Albania )
请帮帮我。提前谢谢。
答案 0 :(得分:0)
您可以尝试如下:
#!/usr/bin/env python3
from subprocess import Popen, PIPE
with Popen(command, stdout=PIPE) as process, open('logfile', 'wb') as file:
for line in process.stdout: # read b'\n'-separated lines
# handle line...
# copy it to file
file.write(line)
有关详情,请访问this link