Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

pythonÖеÄroundÄÚ½¨º¯Êý

 ½ñÌìÓÖɨÁËÒ»±éÊý×ÖÕâÒ»ÕÂ.. ¿´µ½ÁËround()º¯Êý, ÊÇÔÚpythonºËÐıà³Ì˼ÏëµÄ5.6.2½ÚµÄĩβ, Ô­ÎÄÈçÏÂ:
round(flt, ndig=0) ½ÓÊÜÒ»¸ö¸¡µãÊý flt ²¢¶ÔÆäËÄÉáÎåÈ룬±£´æ ndigλСÊý¡£
Èô²»Ìṩndig ²ÎÊý£¬ÔòĬÈÏСÊýµãºó0λ¡£
round()½öÓÃÓÚ¸¡µãÊý¡££¨ÒëÕß×¢£ºÕûÊýÒ²¿ÉÒÔ£¬ ²»¹ý²¢Ã»ÓÐʲô
ʵ¼ÊÒâÒ壩
Æäʵ, ×ö¸öʵÑé¾ÍÖªµÀ, round()¶ÔÕûÊýÒ²ÊÇÓÐÓõÄ, µÚ¶þ¸ö²ÎÊýndigÊÇÒ»¸öÏà¶ÔÆ«ÒÆ. ÊÇÏà¶ÔÓÚСÊýµãÄǸöλÖÃÀ´ËµµÄ, ÏòÓÒ, Ò²¾ÍÊÇСÊý²¿·Ö, ÕýÊýÀ´±íʾ, Ïò×ó, Ò²¾ÍÊÇÕûÊý²¿·Ö, ÓøºÊýÀ´±íʾ.
±ÈÈç:
round(345, -1) = 350.0
round(345, -3) = 0.0
round(345, 0) = 345.0
round(345.2345, 2) = 345.23000000000002
345.2345ËÄÉáÎåÈ뵽СÊýµãºóÁ½Î», Ôõô»á³ÉÕâÑùÄØ??
Õâ¸öÊǾ«¶ÈÎÊÌâÒýÆðµÄ, ²»Ï¸¾¿. ÎÒÃÇÒýÈëdecimalÄ£¿éºó, ʹÓÃdecimal.Decimal(str(round(345.2345, 2)))¾Í¿ÉÒÔ¿´³ö¾«È·µÄÖµÁË.  ÊÇDecimal("345.23")...
Ã÷Ìì·¢²¼ÏÂÒ»¼¯...ºÇºÇ, »¹ÊÇÊý×ÖÏà¹ØµÄ....лл¸÷λÅóÓÑ...


Ïà¹ØÎĵµ£º

[Python ѧϰ]2.5°æyield֮ѧϰÐĵÃ

  shhgs ·¢²¼Á˹ØÓÚ¡¶ Py 2.5 what's new Ö® yield
¡·
Ö®ºó£¬Ô­À´ÎÒ²»ÊÇÌرð¹Ø×¢ yield µÄÓ÷¨£¬ÒòΪ¶ÔÓÚ2.3ÖмÓÈëµÄyieldÏà¶ÔÀ´Ëµ¹¦Äܼòµ¥£¬ËüÊÇ×÷Ϊһ¸ö generator
²»¿ÉȱÉÙµÄÒ»ÌõÓï¾ä£¬Ö»Òª°üº¬ËüµÄº¯Êý¼´ÊÇÒ»¸ö generator ¡£µ«ÔÚ2.3ÖУ¬generator
²»ÄÜÖØÈ룬²»ÄÜÔÚÔËÐйý³ÌÖÐÐ޸ģ¬²»ÄÜÒý·¢Òì³££¬ÄãҪôÊÇ˳Ðò ......

PythonǶÈëC++

PythonǶÈëC++Ïê½â(1)--HelloWorld
À´CSDNµÄʱºò£¬¸Õ¸Õ½Ó´¥Python£¬ÄÇʱºò¶ÔPythonµÄǶÈ벿·ÖºÜ¸ÐÐËȤ£¬Ö»ÊÇһֱûÓÐʱ¼äÀ´ÅªÇåÆäÃæÉ´£¬Òò´ËҲһֱûÓÐʹÓÃǶÈëµÄ¹¦ÄÜ£¬ÁíÒ»¸öÔ­ÒòÊÇÎÒ»¹Ã»ÓÐÕæÕýÓÃPythonд¹ýÒ»¸öÕýʽµÄÓÐÓõãµÄ¶«Î÷£¬²»¹ý£¬ÏÖÔڻعýÍ·À´¼ÌÐø¿´ÕâÒ»²¿·Ö£¬·¢ÏÖ»¹ÊÇͦ¼òµ¥µÄ¡£ÒÔÇ°Ïë°ÑÕⲿ·Ö·­Òë³öÀ´£¬¿ÉÊÇÓ ......

python¼¼Êõ×ÊÁÏ

pythonÖйúÂÛ̳     http://www.okpython.com/bbs/index.php
¿ªÔ´ÉçÇø   http://sourceforge.net/
python¹ÙÍø  http://www.python.org/
pythonIDE BOAhttp://boa-constructor.sourceforge.net/
pythonIDE ´óÈ«http://www.oschina.net/project/tag/120
python×é¼þhttp://py.dw ......

Installing Python °²×°Python


   
You are here: Home ‣ Dive Into Python 3 ‣
Difficulty level: ♦♢♢♢♢
Installing Python °²×°Python
❝ Tempora mutantur nos et mutamur in illis. (Times change, and we change with them.) ❞
— ancient Roman proverb
 
D ......

pythonÖÐÎļþºÍĿ¼²Ù×÷

1£®»ñµÃµ±Ç°Â·¾¶
ÔÚPythonÖпÉÒÔʹÓÃos.getcwd()º¯Êý»ñµÃµ±Ç°µÄ·¾¶¡£ÆäÔ­ÐÍÈçÏÂËùʾ¡£
os.getcwd()
¸Ãº¯Êý²»ÐèÒª´«µÝ²ÎÊý£¬Ëü·µ»Øµ±Ç°µÄĿ¼¡£ÐèҪ˵Ã÷µÄÊÇ£¬µ±Ç°Ä¿Â¼²¢²»ÊÇÖ¸½Å±¾ËùÔÚµÄĿ¼£¬¶øÊÇËùÔËÐнű¾µÄĿ¼¡£ÀýÈ磬ÔÚPythonWinÖÐÊäÈëÈçϽű¾¡£
>>> import os
>>> print 'current director ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ