0
여러 컴퓨터에서 한 행에 여러 번 실행 파일 (delprof2.exe)을 실행하는 작은 프로그램을 작성하려고합니다. PC 이름이 들어간 세 개의 목록을 만들었고 기본적으로 해당 목록의 각 컴퓨터에 대해/c : itroom01 스위치와 함께 실행되도록 실행 파일이 필요하지만 컴퓨터 이름 부분을 코딩하는 방법을 모릅니다. 답장 = 1 섹션에서 내가 얼마나 멀리 있는지 알 수 있습니다.서브 프로세스 라인에 mutiple 인수를 어떻게 추가합니까?
참조 코드 :
import os
import subprocess
itroom = ["itroom01", "itroom02", "itroom03"]
second = ["2nditroom01", "2nditroom02", "2nditroom03"]
csupport = ["csupport-m30", "csupport-m31", "csupport-m32"]
print "Which room's PCs do you want to clear out?"
print "\t(1) = ITRoom"
print "\t(2) = 2nd ITRoom"
print "\t(3) = Curriculum Support"
reply = input("Enter 1, 2 or 3: ")
if reply == 1:
for item in itroom:
subprocess.call(['c:\delprof2\DelProf2.exe /l /c:'%itroom])
raw_input("Press return to continue...")
elif reply == 2:
for item in second:
subprocess.call("c:\delprof2\DelProf2.exe /l")
raw_input("Press return to continue...")
elif reply == 3:
for item in csupport:
subprocess.call("c:\delprof2\DelProf2.exe /l")
raw_input("Press return to continue...")
else:
print "invalid response"
raw_input("Press return to continue...")
은 어떤 도움이 가장 극명하게 될 것이다!
감사합니다. Chris.
모든 항목이 문자열이있는 경우, 당신은 단지 문자열 (
+
) 연결할 수Lovely, 그 맨 위의 작품은 완벽하게 작동합니다. 나는 더 잘 작동 할 것이므로 저 바닥 하나를 통해 좋은 읽을 거리를 갖게 될 것이다! – user3514446