ÓÃpythonʵÏÖcrc32Çó×Ö·û´®Ð£ÑéÂë
תÌû£º
http://blog.csdn.net/wyingquan/archive/2008/12/20/3561094.aspx
ÓÃpython×Ô´øµÄbinasciiÄ£¿é¼ÆËã×Ö·û´®µÄУÑéÂ룬³öÀ´µÄÊǸºÖµ£¬ÓëÓÃcдµÄ³ÌÐòµÃ³öµÄУÑéÂë²»Ò»Ñù£¬ËùÒÔ¾ÍÑо¿ÁËһϡ£·¢ÏÖ±ðÈËÓõÄpython3.0°æ±¾binasciiÄ£¿é¼ÆËã³öµÄcrc32УÑéÂëÊÇÎÒÏëÒªµÄ£¬Ã»°ì·¨Ö»ºÃ×Ô¼ºÓÃpythonʵÏÖÒ»ÏÂcrc32µÄËã·¨ÁË¡£·¢ÏÖËã·¨ºÜ¼òµ¥£¬¾ÍÊÇijЩʵÏÖÀïÃæŪÁ˺ü¸¸öº¯Êýµ¹¸ã¸´ÔÓÁË£¬Æäʵ°´ºËÐÄËã·¨Ëã·¨×ßÒ»±ßºÜÈÝÒ×¾ÍÀí½âºÍÓ¦ÓÃÁË¡£
ÒòΪֱ½Ó´Óc³ÌÐòת¹ýÀ´µÄ£¬½á¹û·¢ÏÖpython2.5£¨ÎÒÓõİ汾ActivePython 2.5.2.2 (ActiveState Software Inc.) based on
Python 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit (Intel)] on win32)ÀïÃæµÄ°´Î»È¡·´¾¡È»²»ÊÇ°´Î»È¡·´£¬ÍøÉÏËѳöºÃ¶àÎÄÕ¶¼Ëµ¡«ÔÚpythonÖÐÊÇ°´Î»È¡·´£¬×Ô¼º²âÊÔÁËÏ£º
>>> ~3,~2,~1,~0,~-1,~-2,~3
(-4, -3, -2, -1, 0, 1, -4)
²Å»ÐÈ»´óÎò£¬ÔÀ´ÊÇÕâÀï³ö´íÁË¡£
ÔÙ¿´£º
>>> import binascii
>>> binascii.crc32("ÎÒÃÇ")
-603163415
Èç¹û°ÑÏÂÃæ´úÂëµÄµ¹ÊýµÚ¶þÐÐ
dwCrc32 = dwCrc32 ^ 0xFFFFFFFFL
¸Ä³É
dwCrc32 = ~dwCrc32
È»ºóÔËÐУºmycrc32("ÎÒÃÇ") µÃµ½½á¹ûÒ²ÊÇ-603163415
ËùÒÔ»³ÒÉpython2.5ÀïÃæÊDz»ÊÇÒ²ÖÐÁËÕâ¸öÏÝÚåÁË¡£
ÓÃÏÂÃæµÄ´úÂëµÃµ½µÄ¾ÍºÍc´úÂë¼ÆËãµÃµ½µÄcrc32УÑéÂëÒ»ÖÂÁË¡£²»¹ýpythonÖ§³ÖµÄÕýÊýÒª±ÈcµÄ´ó£¬ËùÒÔ°´Î»Çó·´ÕâÀïÖ»Äܱ£Ö¤32λÇé¿öϵõ½ºÍc´úÂëÒ»ÑùµÄУÑéÂë¡£
#coding=gbk
def mycrc32(szString):
m_pdwCrc32Table = [0 for x in range(0,256)]
dwPolynomial = 0xEDB88320;
dwCrc = 0
for i in range(0,255):
dwCrc = i
for j in [8,7,6,5,4,3,2,1]:
if dwCrc & 1:
dwCrc = (dwCrc >> 1) ^ dwPolynomial
else:
dwCrc >>= 1
&nb
Ïà¹ØÎĵµ£º
CSDNÕ¾ÄÚתÌû£º
http://blog.csdn.net/kiki113/archive/2009/03/28/4033017.aspx
python µÄÄÚǶtimeÄ£°å·Ò뼰˵Ã÷
Ò»¡¢¼ò½é
timeÄ£¿éÌṩ¸÷ÖÖ²Ù×÷ʱ¼äµÄº¯Êý
˵Ã÷£ºÒ»°ãÓÐÁ½ÖÖ±íʾʱ¼äµÄ·½Ê½:
µÚÒ»ÖÖÊÇʱ¼ä´ÁµÄ·½Ê½(Ïà¶ÔÓÚ1970.1.1 00:00:00ÒÔÃë¼ ......
http://www.autohotkey.com/forum/topic53773.html
Q:I am searching for is a way to execute AHK commands from a Python script. Is this possible?
A:Yes. Here is an example.
tested with python2.6, requires AutoHotkey.dll in the working directory or path...
ahkpython.py:
#Persistent
dllc ......
ÆäʵÒì³£¾ÍÊDz»Õý³££¬¾ÍÊDz»ºÍÎÒÃÇÏëÏóÒ»ÑùÈ¥Ö´ÐС£ËüÊÇÒòΪ³ÌÐò³öÏÖÁË´íÎó¶øÔÚÕý³£¿ØÖÆÁ÷ÒÔÍâ²ÉÈ¡µÄÐÐΪ¡£Python³öÏÖÒì³££¬¾ÍÊÇÒòΪ¼ì²éÁËÒ»¸ö´íÎóʱ£¬Python½âÊÍÆ÷ÎÞ·¨¼ÌÐø¼ÌÐøÖ´ÐÐÏÂÈ¥£¬ÕâʱºòÅ׳öÁËÒì³£¡£ÍùÍùÕâ¸ö´íÎó·ÖΪÓï·¨ÉϺÍÂß¼ÉÏ(²»Éó¤Ëµ¸ÅÄ-_-! )£¬¿´¿´¼¸¸öÀý×Ó£¬×ܽáһϣº
1¡¢NameError£º³¢ÊÔ·ÃÎÊÒ»¸öÎ ......
urllibÄ£¿éÌṩµÄÉϲã½Ó¿Ú£¬Ê¹ÎÒÃÇ¿ÉÒÔÏñ¶ÁÈ¡±¾µØÎļþÒ»Ñù¶ÁÈ¡wwwºÍftpÉϵÄÊý¾Ý¡£Ã¿µ±Ê¹ÓÃÕâ¸öÄ£¿éµÄʱºò£¬ÀÏÊÇ»áÏëÆð¹«Ë¾²úÆ·µÄ¿Í»§¶Ë£¬Í¬ÊÂÓÃC++ÏÂÔØWebÉϵÄͼƬ£¬ÄÇÖÖ“Í´¿à”µÄ±íÇé¡£ÎÒÒÔÇ°·Òë¹ýlibcurl½Ì³Ì£¬ÕâÊÇÔÚC/C++»·¾³Ï±ȽϷ½±ãʵÓõÄÍøÂç²Ù×÷¿â£¬Ïà±ÈÆðlibcurl£¬PythonµÄurl ......
ÓÉÓÚ¹¤×÷ÐèÒª£¬ÓÖҪѧϰеĿª·¢ÓïÑÔ-Python£¬ ÓïÑÔѧ¹ý¼¸ÖÖÁË£¬ ¸Ð¾õ»¹ÊÇÓкöàÏàËƵĵط½£¬ Õâ¸öPython¸Ð¾õ¾Í¸úJavaÓкöàÏàͨµÄµØ·½£¬ Ê×ÏÈÄã¿ÉÒÔÔÚEclipseÉÏͨ¹ýÅäÖúóÀ´¿ª·¢Python¡£ÕâÀïÎÒÌý´ÓÁËÀÏ´óµÄ½¨Ò飬ÅäÖÃÁËÒ»¸öFlexBuilder ×÷ΪPythonµÄIDE½øÐпª·¢¡£
Ä¿Ç°¸Õ¿ªÊ¼Ñ§Ï°PythonµÄ»ù±¾Óï·¨£¬ ½ñÌìÖ÷Òª¿´ÁËÒ»ÏÂPyth ......