ÔÚpythonÖÐʹÓÃdllµ¼³öº¯Êý
×î½üÔÚѧϰpy£¬Êµ¼ùÊÇ£ºÐ£ÑéÖ¸¶¨ÎļþÊÇ·ñ´òÉÏÊý×ÖÇ©Ãû~pythonµÄ±ê×¼¿âÖÐûÓÐÌṩÕâÀຯÊý£¬Í¬Ê±ÔÚÍøÉÏËÑÁËÒ»ÏÂҲûÓÐÕÒµ½µÚÈý·½µÄ°üÓÐÌṩ£¬×îºóÕÒµ½ÁË¿ÉÒÔʹÓÃCrypt32.dllµÄµ¼³öº¯ÊýCryptQueryObject()¡£
Ê×ÏÈÎÒÏ£Íûpywin32µÄ°üÖÐ×îºÃÒÑ·â×°ÕâÑùµÄapi£¬½á¹û·¢ÏÖûÓÐ-_-!¡£ÓÚÊDz»µÃ²»×Ô¼º¶¯ÊÖ~pyÖе÷ÓÃdllµÄµ¼³öº¯Êý·½·¨±È½Ï¼òµ¥£º
from ctypes import *
CryptQueryObject=windll.LoadLibrary("Crypt32.dll").CryptQueryObject
¿ÉÊǽÓÏÂÀ´ÎÊÌâÀ´ÁË¡£¡£CryptQueryObjectÖеIJÎÊýÔõô´¦Àí¡£¡£
BOOL WINAPI CryptQueryObject(
__in DWORD dwObjectType,
__in const void* pvObject,
__in DWORD dwExpectedContentTypeFlags,
__in DWORD dwExpectedFormatTypeFlags,
__in DWORD dwFlags,
__out DWORD* pdwMsgAndCertEncodingType,
__out DWORD* pdwContentType,
__out DWORD* pdwFormatType,
__out HCERTSTORE* phCertStore,
__out HCRYPTMSG* phMsg,
__out const void** ppvContext
);
²ÎÊýÀàÐÍÖÐÓÐÊý×Ö£¬Ö¸Õ룬ºê¶¨Òå¡£pyÖжÔÓÚ²ÎÊýûÓÐÕâô·á¸»µÄ¶¨Ò壬ͬʱҲûÓк궨Ò壬ÓÚÊÇÐèҪת»»³ÉpyÄÜÈÏʶµÄ£¬ÕâÓÖҪʹÓÃctypesÁË£¬googleµ½ÕâÕÅ±í£¬²¢½«ºê¶¨Òå»»³ÉÊýÖµ£º½á¹ûÈçÏÂ
bResult=CryptQueryObject(1,\
c_wchar_p(path),\
1024,\
2,\
0,\
None,\
None,\
None,\
None,\
&n
Ïà¹ØÎĵµ£º
pythonÖÐÀàµÄÊôÐÔ
pythonÖеÄÀà½Ðclass object,ÀàµÄʵÀý½Ðinstance object.
Àà Class Objects
ÀàÓµÓÐÁ½ÖÖ²Ù×÷,1.ÀàÊôÐÔ attribute references 2.ʵÀý»¯instantiation
1.ÀàÊôÐÔ¾ÍÏ൱ÓÚרÊôÓÚÒ»¸öÀàµÄ±äÁ¿(¼´Ä³Ð©ÓïÑÔÖеÄÀàµÄ¾²Ì¬¹«¹²±äÁ¿static public),ʹÓ÷½·¨ÊÇ:ÀàÃû³Æ.ÀàÊôÐÔÃû³Æ
2.ʵÀý»¯ÔòÊÇ´´½¨Ò»¸öÀàµÄʵÀýµÄ· ......
Python¿ìËÙÈëÃÅ
Ŀ¼
1. µÚÒ»Õ Python¿ìËÙÈëÃÅ
&nbs ......
0¡¢×Ö·û´®ÊDz»¿É±äµÄ¡£
1¡¢»ù±¾×Ö·û´®²Ù×÷£ºË÷Òý¡¢ÇÐÆ¬¡¢¸´ÖÆ¡¢³ÉÔ±¡¢³¤¶È¡¢×î´óºÍ×îС¡£
2¡¢×Ö·û´®¸ñʽ»¯£ºÓøñʽ»¯²Ù×÷·û°Ù·ÖºÅ%ʵÏÖ£¬eg:>>> format = "Hello, %s. %s enough for ya?"
  ......
(1).µ±"print os.path.dirname(__file__)"ËùÔڽű¾ÊÇÒÔÍêÕû·¾¶±»ÔËÐеģ¬ ÄÇô½«Êä³ö¸Ã½Å±¾ËùÔÚµÄÍêÕû·¾¶£¬±ÈÈ磺
python d:\pythonSrc\test\test.py
&nb ......
1.1. Óï·¨
1.1.1. if
>>> x=int(raw_input("please enter an integer:"))
please enter an integer:-8
>>> if x<0:
... print 'negative'
... elif x==0:
... print 'zero'
... else:
... print 'positive'
...
negative
ÕâÀïÓм¸¸ö֪ʶµãÐèÒªÌáÐÑ£º
1¡£ºÍ ......