我已经安装了Python 2.7.3和PyScripter。在交互shell在Python中打印简单消息
from ctypes import *
msvcrt = cdll.msvcrt
message_string = "Hello world!\n"
msvcrt.printf("Testing: %s".encode('ascii'), message_string.encode('ascii')
(也试过不编码)
我已经安装了Python 2.7.3和PyScripter。在交互shell在Python中打印简单消息
from ctypes import *
msvcrt = cdll.msvcrt
message_string = "Hello world!\n"
msvcrt.printf("Testing: %s".encode('ascii'), message_string.encode('ascii')
(也试过不编码)
工作对我来说: 当我试图运行这个简单的代码,该interupter不显示任何
>>> msvcrt.printf("Testing: %s".encode('ascii'), message_string.encode('ascii'))
Testing: Hello World!
22
尝试把它在一个.py文件,然后从CMD
python C:\path\to\file
你已经错过了一个尾架'运行)'用于'printf'函数。或者这是一个格式错误? – TerryA
感谢您的快速响应。这是一个格式错误,抱歉。 – Shpongle
你对'import sys;打印类型(sys.stdout)'? – eryksun