我正在尝试为图像列表中定义的每个图像构建一个路径,如果存在则将其删除,目前是下面图像列表中提到的每个图像的硬编码路径..有没有更简单的方法来实现这个?
import os
import subprocess
from subprocess import check_call,Popen, PIPE
def main ():
images=['test1.img','test2.img','test3.img']
ROOT="/local/mnt/workspace"
target="wc3123"
#Construct ROOT + "/out/target/product/" + target + "/test1.img
#for each image mentioned in imageslist remove if it exist"
test1= ROOT + "out/target/product/" + target + "test1.ming"
check_call("rm -rf %s" %test1,shell=True)
if __name__ == '__main__':
main()