파이썬 함수속 for 과if문에서 변수 선언
조회수 677회
def run(command):
subprocess.call(command, shell=True)
# Real-time output but not color display, you can return the result
def sh(command, print_msg=True):
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
lines = []
for line in iter(p.stdout.readline, b''):
line = line.rstrip().decode('utf8')
if print_msg:
global Save_text_console
Save_text_console = lines
lines.append(line)
return lines
run("ipconfig")
while True:
print(Save_text_console)
함수 안에 있는 for 에서 변수를 선언하여 가져오고 싶습니다.
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력