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

RubyºÍPythonµÄÓï·¨±È½Ï


RubyºÍPythonµÄÓï·¨±È½Ï
 
 
 
ÆäʵRubyºÍPython·Ç³£½Ó½ü£¬±È´ó¶àÊý±ðµÄÓïÑÔÒª½Ó½üµÄ¶à£¬ËùÒÔϲ»¶ÓÃɶ¾ÍÓÃɶ£¨´óʵ»°£¬ËäȻҲÊÇ·Ï»°£©¡£Óï·¨ÉϵIJî±ðËäÈ»ÓÐÄÇôһµã£¬´ó²¿·ÖÊÇsyntax sugar£¬ÎÒ¶·µ¨ÉÔ΢Áм¸¸ö£¨pythonÎÒÒ²ÍüµÃ²î²»¶àÁË£¬²»¶ÔµÄ´ó¼Ò¾¡¹ÜÀ´±Þʬ°É£©£¬µ«ÊÇÖ÷Òª²îÒ컹ÊÇÉè¼Æ˼ÏëÉϵģºÁé»îvsÃ÷È·. ÎÒ²»ÈÏΪÁ½ÕßÔÚÉú²úÁ¦ÉÏ»áÓÐʲô²î±ð£¬Èç¹ûÄãÊìϤµÄ»°¡£*×¢Ò⣬½öÏÞÓïÑÔ±¾ÉíµÄ±È½Ï¡£
±¾ÎÄÍƼö£ºRubyÈëÃŽ̳ÌÓë¼¼ÇÉ´óÈ«
RubyºÍPythonµÄ±È½ÏÁбí
1. rubyµÄcase¿ÉÒÔÆ¥ÅäºÜ¶à¶«Î÷£º·¶Î§/Êý×飬¶ÔÏó£¬ÕýÔò±í´ï£¬pythonûÓÐcase/switch¶øʹÓÃif/else±È½ÏËÀ°åµã
2. pythonµÄËõ½øºÜƯÁÁ£¬ËäÈ»ÓÐʱ»áÔì³ÉЩÐíÂé·³¡£rubyµÄendÂùÄÑ¿´µÄ£¬ËùÒÔ´ó¼Ò¶¼±»±Æµ±one liner£¨ÍæЦ£©
3. ¸Ð¾õÉÏruby±Èpython¸üOO,µ±È»ÕâÒ²¿ÉÄÜÊÇÒòΪpython²»ÌᳫÓÃÄÇЩ¸Ä±ä¶ÔÏóÄÚ²¿¹¹ÔìµÄ‘¼¿Á©’Ôì³ÉµÄ´í¾õ
4. pythonÓÐlist comprehension, rubyûÓÐ:(
5. pythonÓÐÕæÕýµÄkeyword argument, rubyÓÃhashÄ£Ä⣬µ±È»Êµ¼ÊÓÃÆðÀ´Ã»Ê²Ã´²î±ð
6. pythonµÄselfºÜÌÖÑᣬrubyûÓÐÄÇÖÖ·±ËöµÄ¶«Î÷
7. reflection£¬rubyÄÚÖÃÁ˺ܶ෽·¨£¬±ÈÈçobject.methods£¬¶øpython°ÑÕâЩÐÅÏ¢´æÔÚÌØÊâµÄ×ÖµäÀï¡£²î²»¶à
8. rubyµÄblock¹¦ÄܺÜÇ¿£¬pythonµÄlambdaÖ»ÄÜ·µ»Øµ¥Ò»Öµ
9. rubyµÄopen classÒѾ­ÉùÃ÷Ô¶²¥£¬¿ÉÒÔÍæ³ö2.days.agoÕâÑùµÄ»¨Ñù£¬pythonºÃÏñû·¨Ö±½ÓÐÞ¸ÄÄÚÖÃÀàÒ²·´¶ÔÕâô×ö¡£
10. pythonÐèÒªÓÃ@classmethodÐÞÊÎÉùÃ÷Àà·½·¨£¬rubyÊÇÄÚ½¨
11. rubyÓе¥×Ó·½·¨£¬Ò²¾Í¶Ô¶ÔÏ󵥶À¶¨ÖÆ£¬python²»ÖªµÀÓÐûÓÐÀàËƸÅÄî
12. rubyÓÐmethod_missing»úÖÆ£¬python¿ÉÒÔʹÓÃ__getattr__½Ø»ñ䶨Òå·½·¨(from qiezi)
13. rubyʹÓõ¥¼Ì³Ð+mixin£¬pythonʹÓöàÖؼ̳У¬²»¹ýpythonÒ²ÓÐmixin
14. rubyÓÐattr_*ϵÁÐÓï·¨helper£¬Ê¡È´×Ô¼ºÐ´Ò»¶Ñsetter/getter, pythonµÄproperty·½·¨»¹ÊǵÃ×Ô¼ºÐ´setter/getter
15. rubyºÍpython¶¼Ê¹ÓÃduck typing£¬²»¹ýpythonÒ²ÓÐÒ»Ì×ÏÔʽµÄinterface»úÖÆ(´Ózope3²¢ÈëÄÚºËÁËô£¿)
16. rubyµÄº¯Êýµ÷ÓÃÀ¨ºÅÊÇ¿ÉÊ¡µÄ£¬ÉÔ΢ÉÙÇü¸Ï¼üÅÌ¡£pythonĬÈÏûÀ¨ºÅÒ²²»´ø²ÎÊýµÄ»°·µ»Øº¯Êý±¾ÉíµÄÒ»¸öÒýÓá£
17. ÎÒ²»Çå³þpythonµÄmeta programmingÄܵ½Ê²Ã´³Ì¶È£¬Ö»ºÃµÈ´óÅ£À´ËµËµÁË¡£Ö»ÊǾõµÃpythoner²»³£ÓÃÄǸö£¬Ò²Ðí¾õµÃ»á°Ñ³ÌÐòÂß¼­¸ãµÃ»Þɬ²»Ã÷¡£
18. ruby´Óperl¼Ì³ÐÁËÒ»²¿·ÖÄÑ¿´µÄ¶«Î÷£¬±ÈÈçºÜ¶àÔ¤¶¨ÒåµÄ$x³£Á¿
19. rubyÄÚ½¨ÕýÔò±í´ï£¬·½±ãÒ»µã


Ïà¹ØÎĵµ£º

Python ²ÎÊý֪ʶ£¨±äÁ¿Ç°¼ÓÐǺŵÄÒâÒ壩

¹ýÁ¿µÄ²ÎÊý
ÔÚÔËÐÐʱ֪µÀÒ»¸öº¯ÊýÓÐʲô²ÎÊý£¬Í¨³£ÊDz»¿ÉÄܵġ£ÁíÒ»¸öÇé¿öÊÇÒ»¸öº¯ÊýÄܲÙ×÷ºÜ¶à¶ÔÏ󡣸üÓÐÉõÕߣ¬µ÷ÓÃ×ÔÉíµÄº¯Êý±ä³ÉÒ»ÖÖapiÌṩ¸ø¿ÉÓõÄÓ¦Óá£
¶ÔÓÚÕâЩÇé¿ö£¬pythonÌṩÁËÁ½ÖÖÌرðµÄ·½·¨À´¶¨Ò庯ÊýµÄ²ÎÊý£¬ÔÊÐíº¯Êý½ÓÊܹýÁ¿µÄ²ÎÊý£¬²»ÓÃÏÔʽÉùÃ÷²ÎÊý¡£ÕâЩ“¶îÍ┵IJÎÊýÏÂÒ»²½ÔÙ½âÊÍ¡£
×¢Òâa ......

python Excel ±à³Ì

1)Excel hyperlink:
xlsApp = win32com.client.Dispatch('Excel.Application')
cell = xls.App.ActiveSheet.Cells(1,1)
cell.Hyperlink.Add(cell,'http://xxx')
2)Excel row/column count:
sht = xlsApp.ActiveSheet
sht.Columns.Areas.Count
sht.Rows.Areas.Count
*************************
£Û1£ÝʹÓÃPyExcelera ......

python µÄÄÚǶtimeÄ£°å·­Ò뼰˵Ã÷

CSDNÕ¾ÄÚתÌû£º
http://blog.csdn.net/kiki113/archive/2009/03/28/4033017.aspx
python µÄÄÚǶtimeÄ£°å·­Ò뼰˵Ã÷
  
Ò»¡¢¼ò½é
  timeÄ£¿éÌṩ¸÷ÖÖ²Ù×÷ʱ¼äµÄº¯Êý
  ˵Ã÷£ºÒ»°ãÓÐÁ½ÖÖ±íʾʱ¼äµÄ·½Ê½:
       µÚÒ»ÖÖÊÇʱ¼ä´ÁµÄ·½Ê½(Ïà¶ÔÓÚ1970.1.1 00:00:00ÒÔÃë¼ ......

Èà easy_install ʹÓôúÀí·­Ç½°²×° Python Ä£¿é

ÀµÓºƣ¨http://laiyonghao.com£©
¹Ø¼ü×Ö£ºpython, easy_install, setuptools, myentunnel, polipo, windows, linux, socks5, http, proxy
ÒòΪһЩÖÚËùÖÜÖªµÄÔ­Òò£¬ÎÒÃÇÓÐЩÍøÕ¾ÎÞ·¨·ÃÎÊ£¬Ôì³ÉÉú»îºÍÉú²úµÄ¾Þ´ó²»±ã¡£ÆäÖжÔÎÒÓ°Ïì±È½Ï´óµÄÒ»¸ö¾ÍÊÇ°²×°Ä³Ð© Python Ä£¿éµÄʱºò£¬easy_install ÎÞ·¨·ÃÎʵ½ÍøÕ¾¡£ÔÚÕâÀï·ÖÏíÈ ......

pythonдµÄ½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z¸ñʽ

#½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z.py
#for folder all file do 7z
import os
import sys
import distutils.file_util
def ImportOkFile():
    if(os.path.isfile("D:\\Records\\½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z_record.txt")==False):
        f=open("D:\\Reco ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ