import ctypes
whnd = ctypes.windll.kernel32.GetConsoleWindow()
if whnd != 0:
ctypes.windll.user32.ShowWindow(whnd, 0)
ctypes.windll.kernel32.CloseHandle(whnd)引用自http://magicpanda.net/2010/10/python%E4%B8%AD%E9%9A%90%E8%97%8Fconsole%E7%AA%97%E5%8F%A3/原文地址:http://blog.csdn.net/u013511642/article/details/43908999