ÇóÖúpython£¬map filter
map£¬filter·½·¨Ó¦¸Ã»á·µ»ØÒ»¸öÁÐ±í¡£
µ«ÊÇÔÚÎÒÕâÀËüÃÇ×ÜÊÇ·µ»Ø£º
<map object at 0x0000000002A2C978>
<filter object at 0x0000000002A2C9E8>
ÎÒÓõÄpython3.1£¬ Õâ¸öÒ²ÊÇ°æ±¾µÄ±ä¶¯µ¼ÖµÄÂð£¿
def map_func(lis):
return lis + 1
li = [1,2,3,4,5]
map_l = map(map_func, li) #½«liÖÐËùÓеÄÊý¶¼+1
print (map_l)
¾ÍÊÇÕâ¸öС³ÌÐò£¬Ôõô¼Óprint£¿
¿´¿´Õâ¸ö
What's New In Python 3.0 http://blog.csdn.net/t_huanghai/archive/2008/12/04/3443782.aspx
ÀïÃæÓжÔpython3.0 map£¨£©º¯Êý½éÉÜ£¬²Î¿¼Ï £¬ÊÔÊÔ print list(map_l)
map() and filter() return iterators. If you really need a list, a quick fix is e.g. list(map(...)), but a better fix is often to use a list comprehension (especially when the original code uses lambda), or rewriting the code so it doesn¡¯t need a list at all. Particularly tricky is map() invoked for the side effects of the function; the correct transformation is to use a regular for loop (since creating a list would just be wasteful).
What's New In Python 3.0
invalid syntax
¿´À´£¬Ó¦¸ÃÕÕËü˵µÄ£¬ ÓÃfor loop
ллС¿µ
print (list£¨map_l£©)
correct format. mark it.
Ïà¹ØÎÊ´ð£º
ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ
ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......
´ó¼ÒºÃ£¬ÎÒÊÇÒ»¸öÐÂÊÖ£¬¸Õ¿ªÊ¼Ñ§python£¬µ«ÊǸտªÊ¼µÄhelloworld¶¼Ã»·¨´òÓ¡£¬ÈÃÎÒºÜÎÞÄΡ£
ÎÒµÄpython°²×°Â·¾¶Îªf:\python31¡£ÔÚpathÖÐÒ²ÉèÖöÔÁË£¬ÔÚwindowsÏÂÔËÐÐÊÇÕâÑùÏÔʾµÄ£¬Ï£Íû¸÷λǰ±²Ö¸µãһϡ£Ð»Ð»
Pyth ......
ÔÚÎı¾ÎļþÖÐÆ¥ÅäÏî°üº¬ÖÐÎÄ
ÈçÄÚÈÝΪ£ºgamename=ÖÐÎÄ
key=ÌìÏÂ
Îı¾ÎļþµÄ±àÂëµÄÎļþΪutf-8
python´úÂëÈçÏ£º
# -*- coding:UTF-8 -*-
contents=open(from_pa ......
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......
ÄÄλǰ±²¿ÉÒÔ¸øÎÒ¸öPythonдµÄ¡¾¿ÉÔËÐеÄÔ´´úÂë¡¿£¬ÊµÏÖÒÔϹ¦ÄÜ£º
1.¶ÔÖ¸¶¨¶Ë¿ÚµÄ¼àÌý²¢½ØÈ¡¡¾Ö¸¶¨¡¿Êý¾Ý°ü
2.Äܶԡ¾×Ô¼º¶¨ÒåµÄ¡¿ÐÒé°ü½øÐнâÎö
Íò·Ö¸Ðл£¡£¡£¡
ÎÒÀ´¶¥ thy38
......