(ctypes的)msvcrt.printf和蟒蛇打印 [英] (ctypes)msvcrt.printf and print in python
本文介绍了(ctypes的)msvcrt.printf和蟒蛇打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在学习有关使用printf函数在Python 2.7使用MSVCRT.DLL,ctypes的一点。
我观察到,使用msvcrt.printf(X)和普通的Python打印(Y)功能时,Y被Xeventhough打印前打印(Y)的语句是msvcret.printf后放( X) 。任何人都可以解释为什么这是怎么回事?
这是我的code:
从ctypes的导入*MSVCRT = cdll.msvcrt
msvcrt.printf(世界,你好!)打印(ABCD)
输出:
ABCD
你好,世界
解决方案
这code可以正常运行,我的环境下,其结果是在这里:
I was learning a bit about using the printf function using msvcrt.dll , ctypes in python 2.7 . I observed that when using the msvcrt.printf("x") and usual python print("y") function, "y" gets printed before "x" eventhough print("y") statement is put after the msvcret.printf("x") . Can anyone explain why this is happening?
This is my code:
from ctypes import *
msvcrt = cdll.msvcrt
msvcrt.printf("hello world!")
print("abcd")
output :
abcd
hello world
解决方案
This code runs correctly under my environment and the result is here:
这篇关于(ctypes的)msvcrt.printf和蟒蛇打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文