PythonÄ£¿éËæÏëËæ¼Ç
ʱ³£¼ûµ½Ò»Ð©ºÃµÄPythonÄ£¿é£¬Èç¹û²»Ëæʱ¼ÇÏ£¬µÈÓõÄʱºòÓÖÊÇÒ»ÕóÂÒ·£¬ºÃÔÚPythonÒýÓÃÒ»¸öÄ£¿é¼«Æä·½±ã£¬OK£¬·Ï»°ÉÙ˵£º
1. decimal
±ê׼ģ¿é£¬2.4ÒýÈ룬ÓÃÓÚ¸¡µãÊýµÄ¾«È·±íʾ£º
>>> 0.1 + 0.1 + 0.1 - 0.3
5.5511151231257827e-17
>>> from decimal import Decimal
>>> def _(x): return Decimal(str(x))
...
>>> _(0.1)+_(0.1)+_(0.1)+_(-0.3)
Decimal('0.0')
Ïà¹ØÎĵµ£º
ÎÒÃǾ³£»á²ÉÓÃÉú²úÕß/Ïû·ÑÕß¹ØϵµÄÁ½¸öÏß³ÌÀ´´¦ÀíÒ»¸ö¹²Ïí»º³åÇøµÄÊý¾Ý¡£ÀýÈçÒ»¸öÉú²úÕßÏ߳̽ÓÊÜÓû§Êý¾Ý·ÅÈëÒ»¸ö¹²Ïí»º³åÇøÀµÈ´ýÒ»¸öÏû·ÑÕßÏß
³Ì¶ÔÊý¾ÝÈ¡³ö´¦Àí¡£µ«ÊÇÈç¹û»º³åÇøµÄ̫С¶øÉú²úÕߺÍÏû·ÑÕßÁ½¸öÒì²½Ï̵߳ÄËٶȲ»Í¬Ê±£¬ÈÝÒ׳öÏÖÒ»¸öÏ̵߳ȴýÁíÒ»¸öÇé¿ö¡£ÎªÁ˾¡¿ÉÄܵÄËõ¶Ì¹²Ïí×ÊÔ´²¢ÒÔÏàͬ
Ëٶȹ¤×÷µÄ¸÷Ïß³ ......
#Ö±½ÓÑ¡ÔñÅÅÐò
def SelectSort(mylist):
size = len(mylist)
i = 0
for i in range(0, size):
k = i
for j in range(i + 1, size):
if mylist[j] < mylist[k]:
k = j
if k != i:
tmp = mylist[i]
......
Çé¾°Ò»£º
ÔÚÎļþ¼ÐÀïÓÐÁùÊ®¶à¸öRM¸ñʽµÄÊÓƵÎļþ£¬ÎÒÏÖÔÚÐèÒª°ÑËüÃǵÄÎļþÃû¶¼ÌáÈ¡³öÀ´£¬²¢È¥µôÎļþµÄÀ©Õ¹Ãû£¬ÒÔ±ã·Åµ½ÐèÒªµÄÍøÒ³Àï¡£
Ó¦¸ÃÓÐʲôÈí¼þ¿ÉÒÔÍê³ÉÕâ¸ö¼òµ¥µÄÒªÇ󣬿ÉÊÇһʱ¼äµ½ÄÄÀïÈ¥ÕÒÕâ ÑùÒ»¸ö·ûºÏÒªÇóµÄÈí¼þÄØ£¿×ܲ»ÄÜÊÖ¹¤Íê³É°Ñ¡£ÔÚLinuxÉÏÓÃÇ¿´óµÄshell½Å±¾Ó¦¸ÃÒ²¿ÉÒÔÍê³É£¬¿ÉÊÇʹÓÃWindowsµÄÅóÓÑÄØ£¿Æä ......
²Î¿¼Á´½Ó£ºhttp://www.woodpecker.org.cn/diveintopython/functional_programming/dynamic_import.html
Ò» ¶¯Ì¬µ¼ÈëÄ£¿é
PythonµÄimport²»ÄܽÓÊܱäÁ¿£¬ËùÒÔÓ¦¸ÃÓà __import__º¯ÊýÀ´¶¯Ì¬µ¼Èë¡£
ÈçϵĴúÂëÎÞ·¨Õý³£µ¼ÈëÄ£¿é
modules = ['OpenSSL', 'Crypto', 'MySQLdb', 'sqlite3', 'zope.interface', 'pyasn1', 'twisted ......
ÔÚWindowsÀï´î½¨PythonµÄGTK+»·¾³»¹ÊDZȽÏÂé·³µÄÓÐÒÔϼ¸¸ö×¢ÒâÊÂÏî
1¡¢PyGTKÍøÕ¾ÉÏϵİü£¬¿ÉÄÜûÓÐGladeÀࣨLib\site-packages\gtk-2.0\gtkĿ¼ÏÂûÓÐglade.pyd£©£¬Èç¹ûûÓÐÕâ¸öÀàÄã¾ÍÎÞ·¨ÔÚ³ÌÐòÀïµ¼ÈëGlade¹¤¾ß´´½¨µÄxml£¬ÊÖд½çÃ滹ÊÇͦÂé·³µÄ¡£
2¡¢GTKÍøÕ¾ÉϵÄGTK°ü£¬Ã»ÓаüÀ¨GladeµÄDLLÎļþ£¬»¹ÊÇÎÞ·¨¶ÁÈëGladeµÄxm ......