Python - NT에서 popen 호출하기

  • Post author:
  • Post category:
  • Post comments:0 Comments
  • Post last modified:September 15, 2005

비-유닉스 플랫폼에서 파이썬 사용하기라는 문서는 NT에서 popen 함수를 호출하는 방법에 관해 설명합니다. 그리고 같은 프로그램으로 다른 플랫폼에서 다른 기능들을 사용하는 법에 대해서도 설명합니다. 이 두가지를 모두 응용하면 다음과 같은 코드가 됩니다.


   import sys
   if sys.platform == "win32":
      import win32pipe
      popen = win32pipe.popen
   else:
      import os
      popen = os.popen


   f = popen('dir /c c:\\')
   print f.readlines()
   f.close()
Author Details
Kubernetes, DevSecOps, AWS, 클라우드 보안, 클라우드 비용관리, SaaS 의 활용과 내재화 등 소프트웨어 개발 전반에 도움이 필요하다면 도움을 요청하세요. 지인이라면 가볍게 도와드리겠습니다. 전문적인 도움이 필요하다면 저의 현업에 방해가 되지 않는 선에서 협의가능합니다.
0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments